SET IDENTITY_INSERT [CMS_Query] ON
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12715, N'select', 0, N'SELECT ##COLUMNS## FROM OM_ActivityType WHERE [ActivityTypeID] = @ID', 0, 2857, 0, '20110829 16:45:37', '7355bb93-7ea6-420e-9145-501b7bbba133', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12716, N'delete', 0, N'DELETE FROM OM_ActivityType WHERE [ActivityTypeID] = @ID', 0, 2857, 0, '20110829 16:45:37', 'a724f7e2-72ea-4b00-a0b3-81d520919403', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12717, N'insert', 0, N'INSERT INTO OM_ActivityType ([ActivityTypeDisplayName], [ActivityTypeName], [ActivityTypeEnabled], [ActivityTypeIsCustom], [ActivityTypeDescription], [ActivityTypeManualCreationAllowed], [ActivityTypeMainFormControl], [ActivityTypeDetailFormControl] ) VALUES ( @ActivityTypeDisplayName, @ActivityTypeName, @ActivityTypeEnabled, @ActivityTypeIsCustom, @ActivityTypeDescription, @ActivityTypeManualCreationAllowed, @ActivityTypeMainFormControl, @ActivityTypeDetailFormControl); SELECT SCOPE_IDENTITY() AS [ActivityTypeID]', 1, 2857, 0, '20110829 16:45:37', 'a10ce9ce-09ea-4f46-815a-01e22eeac27f', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12719, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_ActivityType WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2857, 0, '20110829 16:45:37', '7c63fd3c-1012-41b6-8331-aa0d1acbf655', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12720, N'deleteall', 0, N'DELETE FROM OM_ActivityType WHERE ##WHERE##', 0, 2857, 0, '20110829 16:45:37', 'f12ce814-5312-4040-bd55-a365264b80be', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12721, N'updateall', 0, N'UPDATE OM_ActivityType SET ##COLUMNS## WHERE ##WHERE##', 0, 2857, 0, '20110829 16:45:37', '6728bc99-8d74-43fc-accf-d5bd3262d55e', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12718, N'update', 0, N'UPDATE OM_ActivityType SET [ActivityTypeDisplayName] = @ActivityTypeDisplayName, [ActivityTypeName] = @ActivityTypeName, [ActivityTypeEnabled] = @ActivityTypeEnabled, [ActivityTypeIsCustom] = @ActivityTypeIsCustom, [ActivityTypeDescription] = @ActivityTypeDescription, [ActivityTypeManualCreationAllowed] = @ActivityTypeManualCreationAllowed, [ActivityTypeMainFormControl] = @ActivityTypeMainFormControl, [ActivityTypeDetailFormControl] = @ActivityTypeDetailFormControl WHERE [ActivityTypeID] = @ActivityTypeID', 0, 2857, 0, '20110829 16:52:26', '2039d21d-4853-450e-add8-2cc3049efe58', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13682, N'selectfromscorecontactrule', 0, N'SELECT ##TOPN## ##COLUMNS## FROM [OM_ScoreContactRule] WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2940, 0, '20110901 15:54:33', '20894bca-1019-43b2-9b38-3c245677758d', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13365, N'select', 0, N'SELECT ##COLUMNS## FROM OM_Rule WHERE [RuleID] = @ID', 0, 2920, 0, '20110902 14:01:39', 'a7b292da-45c5-4a76-af1a-e718ac94d4ae', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13366, N'delete', 0, N'DELETE FROM OM_Rule WHERE [RuleID] = @ID', 0, 2920, 0, '20110902 14:01:39', '86a2a054-1b54-450f-850b-614e976f3470', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13367, N'insert', 0, N'INSERT INTO OM_Rule ([RuleScoreID], [RuleDisplayName], [RuleName], [RuleValue], [RuleIsRecurring], [RuleMaxPoints], [RuleValidUntil], [RuleValidity], [RuleValidFor], [RuleType], [RuleParameter], [RuleCondition], [RuleLastModified], [RuleGUID], [RuleSiteID] ) VALUES ( @RuleScoreID, @RuleDisplayName, @RuleName, @RuleValue, @RuleIsRecurring, @RuleMaxPoints, @RuleValidUntil, @RuleValidity, @RuleValidFor, @RuleType, @RuleParameter, @RuleCondition, @RuleLastModified, @RuleGUID, @RuleSiteID); SELECT SCOPE_IDENTITY() AS [RuleID]', 1, 2920, 0, '20110902 14:01:39', '0609f1d4-61e2-40d8-b25b-2e574e7528a1', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13368, N'update', 0, N'UPDATE OM_Rule SET [RuleScoreID] = @RuleScoreID, [RuleDisplayName] = @RuleDisplayName, [RuleName] = @RuleName, [RuleValue] = @RuleValue, [RuleIsRecurring] = @RuleIsRecurring, [RuleMaxPoints] = @RuleMaxPoints, [RuleValidUntil] = @RuleValidUntil, [RuleValidity] = @RuleValidity, [RuleValidFor] = @RuleValidFor, [RuleType] = @RuleType, [RuleParameter] = @RuleParameter, [RuleCondition] = @RuleCondition, [RuleLastModified] = @RuleLastModified, [RuleGUID] = @RuleGUID, [RuleSiteID] = @RuleSiteID WHERE [RuleID] = @RuleID', 0, 2920, 0, '20110902 14:01:39', 'c14ccdd4-f022-4814-b1f8-897d2fe47202', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13369, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_Rule WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2920, 0, '20110902 14:01:39', '94aedaac-29ee-482d-a157-9602e00ef26a', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13419, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_Rule WHERE (RuleLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 2920, 0, '20110902 14:01:39', 'bfe73662-9d8c-482a-a19f-c83330b91a64', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13370, N'deleteall', 0, N'DELETE FROM OM_Rule WHERE ##WHERE##', 0, 2920, 0, '20110902 14:01:39', '5d5cca8b-0db9-440f-a0c6-747567fe0a3c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13371, N'updateall', 0, N'UPDATE OM_Rule SET ##COLUMNS## WHERE ##WHERE##', 0, 2920, 0, '20110902 14:01:39', '2126962f-3e57-4268-8bb3-4569c91aaee6', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13683, N'selectdatajoined', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_Score INNER JOIN OM_ScoreContactRule ON OM_Score.ScoreID=OM_ScoreContactRule.ScoreID WHERE ##WHERE##', 0, 2940, 0, '20110902 17:08:50', 'e0903bc9-dec4-484b-ba78-b39f27fa6144', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12722, N'select', 0, N'SELECT ##COLUMNS## FROM OM_PageVisit WHERE [PageVisitID] = @ID', 0, 2858, 0, '20110902 17:39:25', '9b6e604d-5c44-4773-8212-b355ad1f1318', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12723, N'delete', 0, N'DELETE FROM OM_PageVisit WHERE [PageVisitID] = @ID', 0, 2858, 0, '20110902 17:39:25', '7b3f6b1a-0c50-4ce8-9d28-f2ccbe9c6478', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12724, N'insert', 0, N'INSERT INTO OM_PageVisit ([PageVisitDetail], [PageVisitActivityID], [PageVisitABVariantName], [PageVisitMVTCombinationName] ) VALUES ( @PageVisitDetail, @PageVisitActivityID, @PageVisitABVariantName, @PageVisitMVTCombinationName); SELECT SCOPE_IDENTITY() AS [PageVisitID]', 1, 2858, 0, '20110902 17:39:25', 'a279fe24-96d4-4205-bd22-a1ff5acea361', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12725, N'update', 0, N'UPDATE OM_PageVisit SET [PageVisitDetail] = @PageVisitDetail, [PageVisitActivityID] = @PageVisitActivityID, [PageVisitABVariantName] = @PageVisitABVariantName, [PageVisitMVTCombinationName] = @PageVisitMVTCombinationName WHERE [PageVisitID] = @PageVisitID', 0, 2858, 0, '20110902 17:39:25', 'a459de95-0258-49f3-bb08-f67e22756044', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12726, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_PageVisit WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2858, 0, '20110902 17:39:25', '16cc87d0-453d-4a53-aced-45b00078a6d6', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12727, N'deleteall', 0, N'DELETE FROM OM_PageVisit WHERE ##WHERE##', 0, 2858, 0, '20110902 17:39:25', '1f45a1aa-2e71-4211-adfa-9649de4206c6', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12728, N'updateall', 0, N'UPDATE OM_PageVisit SET ##COLUMNS## WHERE ##WHERE##', 0, 2858, 0, '20110902 17:39:25', 'c581d20d-5932-4a52-b5fd-dfc1b26b861f', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12736, N'select', 0, N'SELECT ##COLUMNS## FROM OM_Search WHERE [SearchID] = @ID', 0, 2860, 0, '20110902 17:41:36', 'f6178765-cb49-4cb1-9af4-4bac2b92e836', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12737, N'delete', 0, N'DELETE FROM OM_Search WHERE [SearchID] = @ID', 0, 2860, 0, '20110902 17:41:36', '8c424d45-cca9-41e5-b1ef-74b4eb6120a4', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12738, N'insert', 0, N'INSERT INTO OM_Search ([SearchActivityID], [SearchProvider], [SearchKeywords] ) VALUES ( @SearchActivityID, @SearchProvider, @SearchKeywords); SELECT SCOPE_IDENTITY() AS [SearchID]', 1, 2860, 0, '20110902 17:41:36', '1490f151-8704-4488-80ad-49cfaff40691', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12739, N'update', 0, N'UPDATE OM_Search SET [SearchActivityID] = @SearchActivityID, [SearchProvider] = @SearchProvider, [SearchKeywords] = @SearchKeywords WHERE [SearchID] = @SearchID', 0, 2860, 0, '20110902 17:41:36', '6a318d4d-3151-4a32-8320-836ba28830be', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12740, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_Search WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2860, 0, '20110902 17:41:36', '2488912c-f8cd-4005-aaf2-dbf084574c63', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12741, N'deleteall', 0, N'DELETE FROM OM_Search WHERE ##WHERE##', 0, 2860, 0, '20110902 17:41:36', 'bbb2755d-53d5-4c74-9c23-c9422bb99d21', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12742, N'updateall', 0, N'UPDATE OM_Search SET ##COLUMNS## WHERE ##WHERE##', 0, 2860, 0, '20110902 17:41:36', '05c7c270-d0fd-4a63-8143-50324242d2ef', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4718, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM COM_OptionCategory WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 1596, 0, '20110905 16:29:14', '442799e5-6112-46bc-ba54-4371b73bbda2', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13692, N'deleteall', 0, N'DELETE FROM COM_OptionCategory WHERE ##WHERE##', 0, 1596, 0, '20110905 16:29:14', 'bf1c5d57-b5fb-4779-9ab9-8fe924481998', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13693, N'updateall', 0, N'UPDATE COM_OptionCategory SET ##COLUMNS## WHERE ##WHERE##', 0, 1596, 0, '20110905 16:29:14', '74f502f1-4708-49b3-adab-0a4b6f866555', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13275, N'processlog', 0, N'INSERT INTO OM_Activity ([ActivityActiveContactID], [ActivityOriginalContactID], [ActivityCreated], [ActivityType], [ActivityItemID], [ActivityItemDetailID], [ActivityValue], [ActivityURL], [ActivityTitle], [ActivityNodeID], [ActivitySiteID], [ActivityGUID], [ActivityIPAddress], [ActivityCampaign], [ActivityComment], [ActivityURLReferrer], [ActivityCulture] ) VALUES ( @ActivityActiveContactID, @ActivityOriginalContactID, @ActivityCreated, @ActivityType, @ActivityItemID, @ActivityItemDetailID, @ActivityValue, @ActivityURL, @ActivityTitle, @ActivityNodeID, @ActivitySiteID, @ActivityGUID, @ActivityIPAddress, @ActivityCampaign, @ActivityComment, @ActivityURLReferrer, @ActivityCulture); SELECT SCOPE_IDENTITY() AS [ActivityID]', 0, 2854, 0, '20110906 15:57:48', 'b22e75c7-b596-4285-bfa2-3339d7ecadf2', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13694, N'setcontactsintoaccount', 1, N'Proc_OM_AccountContact_ContactsIntoAccount', 0, 2848, 0, '20110906 20:17:17', '4e407fe9-cfa5-4636-adcf-78efaae068d5', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13695, N'setaccountsintocontact', 1, N'Proc_OM_AccountContact_AccountsIntoContact', 0, 2848, 0, '20110906 20:55:30', '89e7e075-f73e-4e8b-b26c-77f32e79ee8e', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12362, N'select', 0, N'SELECT ##COLUMNS## FROM OM_MVTCombination WHERE [MVTCombinationID] = @ID', 0, 2808, 0, '20110908 17:58:50', '56057dce-cd0e-45ff-904c-9cb3fd83d441', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12363, N'delete', 0, N'DELETE FROM OM_MVTCombination WHERE [MVTCombinationID] = @ID', 0, 2808, 0, '20110908 17:58:50', '5398f156-2e39-4b28-b145-9ab6deacec30', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12364, N'insert', 0, N'INSERT INTO OM_MVTCombination ([MVTCombinationName], [MVTCombinationCustomName], [MVTCombinationPageTemplateID], [MVTCombinationEnabled], [MVTCombinationGUID], [MVTCombinationLastModified], [MVTCombinationIsDefault], [MVTCombinationConversions], [MVTCombinationDocumentID] ) VALUES ( @MVTCombinationName, @MVTCombinationCustomName, @MVTCombinationPageTemplateID, @MVTCombinationEnabled, @MVTCombinationGUID, @MVTCombinationLastModified, @MVTCombinationIsDefault, @MVTCombinationConversions, @MVTCombinationDocumentID); SELECT SCOPE_IDENTITY() AS [MVTCombinationID]', 1, 2808, 0, '20110908 17:58:50', 'da6277cd-af8a-4b5d-b04e-a515bd1f5172', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12365, N'update', 0, N'UPDATE OM_MVTCombination SET [MVTCombinationName] = @MVTCombinationName, [MVTCombinationCustomName] = @MVTCombinationCustomName, [MVTCombinationPageTemplateID] = @MVTCombinationPageTemplateID, [MVTCombinationEnabled] = @MVTCombinationEnabled, [MVTCombinationGUID] = @MVTCombinationGUID, [MVTCombinationLastModified] = @MVTCombinationLastModified, [MVTCombinationIsDefault] = @MVTCombinationIsDefault, [MVTCombinationConversions] = @MVTCombinationConversions, [MVTCombinationDocumentID] = @MVTCombinationDocumentID WHERE [MVTCombinationID] = @MVTCombinationID', 0, 2808, 0, '20110908 17:58:50', '33183204-e488-4e79-976f-420b6633a6e0', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12366, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_MVTCombination WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2808, 0, '20110908 17:58:50', 'cc2622be-a2ec-4ce9-b6e3-58620f9c188f', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12821, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_MVTCombination WHERE (MVTCombinationLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 2808, 0, '20110908 17:58:50', '19bcd508-3bda-49a2-aedd-7e85abdf98c5', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12367, N'deleteall', 0, N'DELETE FROM OM_MVTCombination WHERE ##WHERE##', 0, 2808, 0, '20110908 17:58:50', '787a98cd-81f9-4e79-8b26-38a815a80d34', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12368, N'updateall', 0, N'UPDATE OM_MVTCombination SET ##COLUMNS## WHERE ##WHERE##', 0, 2808, 0, '20110908 17:58:50', '00dcf26f-3b22-4dbe-bc00-627592646579', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6464, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Board_Board WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 1788, 0, '20110909 14:37:18', '5ffd4a88-ceac-4c8e-b47f-67dadeaee60c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13087, N'deleteall', 0, N'DELETE FROM Board_Board WHERE ##WHERE##', 0, 1788, 0, '20110909 14:37:18', 'f9cd6566-cb4e-41b7-994d-8e6e53ac2cfd', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13088, N'updateall', 0, N'UPDATE Board_Board SET ##COLUMNS## WHERE ##WHERE##', 0, 1788, 0, '20110909 14:37:18', '2ff9cb89-8c6e-44fe-b3a7-6cfab287a7c1', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12626, N'select', 0, N'SELECT ##COLUMNS## FROM OM_Contact WHERE [ContactID] = @ID', 0, 2841, 0, '20110911 10:31:39', '7575b442-de96-47ab-8f6f-8e4fc661bd98', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12627, N'delete', 0, N'DELETE FROM OM_Contact WHERE [ContactID] = @ID', 0, 2841, 0, '20110911 10:31:39', '8edb8dbd-07a1-41d4-8b61-2d481eb42432', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12628, N'insert', 0, N'INSERT INTO OM_Contact ([ContactFirstName], [ContactMiddleName], [ContactLastName], [ContactSalutation], [ContactTitleBefore], [ContactTitleAfter], [ContactJobTitle], [ContactAddress1], [ContactAddress2], [ContactCity], [ContactZIP], [ContactStateID], [ContactCountryID], [ContactMobilePhone], [ContactHomePhone], [ContactBusinessPhone], [ContactEmail], [ContactWebSite], [ContactBirthday], [ContactGender], [ContactStatusID], [ContactNotes], [ContactOwnerUserID], [ContactMonitored], [ContactMergedWithContactID], [ContactIsAnonymous], [ContactSiteID], [ContactGUID], [ContactLastModified], [ContactCreated], [ContactMergedWhen], [ContactGlobalContactID], [ContactBounces], [ContactLastLogon], [ContactCampaign] ) VALUES ( @ContactFirstName, @ContactMiddleName, @ContactLastName, @ContactSalutation, @ContactTitleBefore, @ContactTitleAfter, @ContactJobTitle, @ContactAddress1, @ContactAddress2, @ContactCity, @ContactZIP, @ContactStateID, @ContactCountryID, @ContactMobilePhone, @ContactHomePhone, @ContactBusinessPhone, @ContactEmail, @ContactWebSite, @ContactBirthday, @ContactGender, @ContactStatusID, @ContactNotes, @ContactOwnerUserID, @ContactMonitored, @ContactMergedWithContactID, @ContactIsAnonymous, @ContactSiteID, @ContactGUID, @ContactLastModified, @ContactCreated, @ContactMergedWhen, @ContactGlobalContactID, @ContactBounces, @ContactLastLogon, @ContactCampaign); SELECT SCOPE_IDENTITY() AS [ContactID]', 1, 2841, 0, '20110911 10:31:39', '789bf523-6bcf-4f9e-b706-8abba1c60597', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12629, N'update', 0, N'UPDATE OM_Contact SET [ContactFirstName] = @ContactFirstName, [ContactMiddleName] = @ContactMiddleName, [ContactLastName] = @ContactLastName, [ContactSalutation] = @ContactSalutation, [ContactTitleBefore] = @ContactTitleBefore, [ContactTitleAfter] = @ContactTitleAfter, [ContactJobTitle] = @ContactJobTitle, [ContactAddress1] = @ContactAddress1, [ContactAddress2] = @ContactAddress2, [ContactCity] = @ContactCity, [ContactZIP] = @ContactZIP, [ContactStateID] = @ContactStateID, [ContactCountryID] = @ContactCountryID, [ContactMobilePhone] = @ContactMobilePhone, [ContactHomePhone] = @ContactHomePhone, [ContactBusinessPhone] = @ContactBusinessPhone, [ContactEmail] = @ContactEmail, [ContactWebSite] = @ContactWebSite, [ContactBirthday] = @ContactBirthday, [ContactGender] = @ContactGender, [ContactStatusID] = @ContactStatusID, [ContactNotes] = @ContactNotes, [ContactOwnerUserID] = @ContactOwnerUserID, [ContactMonitored] = @ContactMonitored, [ContactMergedWithContactID] = @ContactMergedWithContactID, [ContactIsAnonymous] = @ContactIsAnonymous, [ContactSiteID] = @ContactSiteID, [ContactGUID] = @ContactGUID, [ContactLastModified] = @ContactLastModified, [ContactCreated] = @ContactCreated, [ContactMergedWhen] = @ContactMergedWhen, [ContactGlobalContactID] = @ContactGlobalContactID, [ContactBounces] = @ContactBounces, [ContactLastLogon] = @ContactLastLogon, [ContactCampaign] = @ContactCampaign WHERE [ContactID] = @ContactID', 0, 2841, 0, '20110911 10:31:39', '3482bb3a-c8d5-4e39-a10f-f1424d8cbe5b', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12630, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_Contact WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2841, 0, '20110911 10:31:39', '3a6c3e5a-f573-493d-9dd4-654321bab602', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12792, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_Contact WHERE (ContactLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 2841, 0, '20110911 10:31:39', '9df2f5a7-a411-4ae4-a544-027e4cd21ec7', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12631, N'deleteall', 0, N'DELETE FROM OM_Contact WHERE ##WHERE##', 0, 2841, 0, '20110911 10:31:39', '785bdec9-44b7-4600-b6ee-4643516caf05', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12632, N'updateall', 0, N'UPDATE OM_Contact SET ##COLUMNS## WHERE ##WHERE##', 0, 2841, 0, '20110911 10:31:39', 'ca07d74a-dc90-4a88-87cf-d6735fb40372', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13471, N'selectscorecontact', 0, N'SELECT ##TOPN## ##COLUMNS## FROM (SELECT OM_Contact.ContactID, ContactStatusID, ScoreID, Expiration, Value, OM_Contact.ContactSiteID,
ISNULL(OM_Contact.ContactFirstName,'''') +
CASE OM_Contact.ContactFirstName
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '' ''
END
+ ISNULL(OM_Contact.ContactMiddleName,'''') +
CASE OM_Contact.ContactMiddleName
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '' ''
END
+ ISNULL(OM_Contact.ContactLastName, '''') AS ContactFullNameJoined
FROM OM_Contact
INNER JOIN OM_ScoreContactRule ON OM_Contact.ContactID = OM_ScoreContactRule.ContactID) as OM_SelectScoreContact WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2841, 0, '20110911 18:57:58', 'bcc34746-0d1c-4615-adb4-a4cdabc1d2a4', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7126, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Media_File WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 1935, 0, '20110913 13:46:30', 'b52e151b-f880-4395-a514-eb481d2928d3', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12398, N'deleteall', 0, N'DELETE FROM Media_File WHERE ##WHERE##', 0, 1935, 0, '20110913 13:46:30', 'd1340bcb-527f-4815-9666-590846349757', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12399, N'updateall', 0, N'UPDATE Media_File SET ##COLUMNS## WHERE ##WHERE##', 0, 1935, 0, '20110913 13:46:30', 'd38d511e-f31a-41c9-8956-ca7f2d4af4ff', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13696, N'GetUserMemberships', 0, N'SELECT ##TOPN## ##COLUMNS## FROM CMS_Membership JOIN CMS_MembershipUser ON CMS_Membership.MembershipID = CMS_MembershipUser.MembershipID WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2785, 0, '20110913 16:43:06', '7004880a-723b-442c-a132-6c61eafd05b5', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13704, N'UpdateAfterImport', 1, N'Proc_CMS_UIElement_UpdateAfterImport', 0, 2195, 0, '20110914 13:54:42', 'd97f2177-f6ca-4299-bb4a-3711457c0385', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13705, N'selectcontactscore', 0, N'SELECT ##TOPN## ##COLUMNS## FROM (
SELECT
	SUM(OM_ScoreContactRule.Value) as ScoreValue,
	OM_Contact.ContactID,
        OM_Score.ScoreID,
        ScoreEnabled,
        ScoreSiteID,
        ScoreEmailAtScore,
        ScoreDisplayName
FROM OM_Contact
INNER JOIN OM_ScoreContactRule ON OM_Contact.ContactID = OM_ScoreContactRule.ContactID
INNER JOIN OM_Score ON OM_ScoreContactRule.ScoreID = OM_Score.ScoreID
INNER JOIN OM_Rule ON OM_ScoreContactRule.RuleID = OM_Rule.RuleID
GROUP BY OM_Contact.ContactID, ScoreEnabled, ScoreSiteID, ScoreDisplayName, OM_Score.ScoreID, ScoreEmailAtScore) as ContactScoreList WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2841, 0, '20110914 15:45:03', '220039ab-80f2-41ef-baf7-f8144d5828d4', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10677, N'select', 0, N'SELECT ##COLUMNS## FROM OM_ABVariant WHERE [ABVariantID] = @ID', 0, 2492, 0, '20110914 16:37:15', '6c8b3549-a49e-4eb7-8b43-12ba4b35ce43', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10678, N'delete', 0, N'DELETE FROM OM_ABVariant WHERE [ABVariantID] = @ID', 0, 2492, 0, '20110914 16:37:15', '489983d9-92f8-46de-bd43-9963df71b7e0', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10679, N'insert', 0, N'INSERT INTO OM_ABVariant ([ABVariantDisplayName], [ABVariantName], [ABVariantTestID], [ABVariantPath], [ABVariantViews], [ABVariantConversions], [ABVariantGUID], [ABVariantLastModified], [ABVariantSiteID] ) VALUES ( @ABVariantDisplayName, @ABVariantName, @ABVariantTestID, @ABVariantPath, @ABVariantViews, @ABVariantConversions, @ABVariantGUID, @ABVariantLastModified, @ABVariantSiteID); SELECT SCOPE_IDENTITY() AS [ABVariantID]', 1, 2492, 0, '20110914 16:37:15', '2a6d3299-5cb6-4e89-8e0d-9e089b81540d', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10680, N'update', 0, N'UPDATE OM_ABVariant SET [ABVariantDisplayName] = @ABVariantDisplayName, [ABVariantName] = @ABVariantName, [ABVariantTestID] = @ABVariantTestID, [ABVariantPath] = @ABVariantPath, [ABVariantViews] = @ABVariantViews, [ABVariantConversions] = @ABVariantConversions, [ABVariantGUID] = @ABVariantGUID, [ABVariantLastModified] = @ABVariantLastModified, [ABVariantSiteID] = @ABVariantSiteID WHERE [ABVariantID] = @ABVariantID', 0, 2492, 0, '20110914 16:37:15', '926cae77-10df-4af5-8f91-d3adf7b2dfe9', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10681, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_ABVariant WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2492, 0, '20110914 16:37:15', 'e9f16144-4832-49eb-8664-b4b111fd3ee0', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10788, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_ABVariant WHERE (ABVariantLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 2492, 0, '20110914 16:37:15', 'ddc67072-27cf-4217-9b5a-3e603a365b10', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12907, N'deleteall', 0, N'DELETE FROM OM_ABVariant WHERE ##WHERE##', 0, 2492, 0, '20110914 16:37:15', 'c607c07a-5691-4927-be5b-2e198895d509', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12908, N'updateall', 0, N'UPDATE OM_ABVariant SET ##COLUMNS## WHERE ##WHERE##', 0, 2492, 0, '20110914 16:37:15', '912336a9-f211-45c0-b45d-3470445fe3d9', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10672, N'select', 0, N'SELECT ##COLUMNS## FROM OM_ABTest WHERE [ABTestID] = @ID', 0, 2491, 0, '20110914 16:37:31', '31381bcb-b7c0-4407-8d1b-b3fbe76d0291', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10673, N'delete', 0, N'DELETE FROM OM_ABTest WHERE [ABTestID] = @ID', 0, 2491, 0, '20110914 16:37:32', 'bbc36bdb-f4b3-4042-a8d9-3d4a63e4e4f6', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10674, N'insert', 0, N'INSERT INTO OM_ABTest ([ABTestName], [ABTestDescription], [ABTestCulture], [ABTestOriginalPage], [ABTestOpenFrom], [ABTestOpenTo], [ABTestEnabled], [ABTestSiteID], [ABTestMaxConversions], [ABTestConversions], [ABTestGUID], [ABTestLastModified], [ABTestTargetConversionType], [ABTestDisplayName] ) VALUES ( @ABTestName, @ABTestDescription, @ABTestCulture, @ABTestOriginalPage, @ABTestOpenFrom, @ABTestOpenTo, @ABTestEnabled, @ABTestSiteID, @ABTestMaxConversions, @ABTestConversions, @ABTestGUID, @ABTestLastModified, @ABTestTargetConversionType, @ABTestDisplayName); SELECT SCOPE_IDENTITY() AS [ABTestID]', 1, 2491, 0, '20110914 16:37:32', 'df185cde-6360-422c-b47c-5fd4d0b018e6', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10675, N'update', 0, N'UPDATE OM_ABTest SET [ABTestName] = @ABTestName, [ABTestDescription] = @ABTestDescription, [ABTestCulture] = @ABTestCulture, [ABTestOriginalPage] = @ABTestOriginalPage, [ABTestOpenFrom] = @ABTestOpenFrom, [ABTestOpenTo] = @ABTestOpenTo, [ABTestEnabled] = @ABTestEnabled, [ABTestSiteID] = @ABTestSiteID, [ABTestMaxConversions] = @ABTestMaxConversions, [ABTestConversions] = @ABTestConversions, [ABTestGUID] = @ABTestGUID, [ABTestLastModified] = @ABTestLastModified, [ABTestTargetConversionType] = @ABTestTargetConversionType, [ABTestDisplayName] = @ABTestDisplayName WHERE [ABTestID] = @ABTestID', 0, 2491, 0, '20110914 16:37:32', '48a0bfbc-ab73-4955-97d1-8b55e1ba00c8', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (10676, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_ABTest WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2491, 0, '20110914 16:37:32', 'ffbb0aaa-263a-430e-84cf-f096e7a64e4c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (11119, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_ABTest WHERE (ABTestLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 2491, 0, '20110914 16:37:32', '1811a16b-8b70-4437-9b1f-6a8484b5e3a6', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12408, N'deleteall', 0, N'DELETE FROM OM_ABTest WHERE ##WHERE##', 0, 2491, 0, '20110914 16:37:32', '4780420d-d2cb-478b-9907-21269a5253c3', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12409, N'updateall', 0, N'UPDATE OM_ABTest SET ##COLUMNS## WHERE ##WHERE##', 0, 2491, 0, '20110914 16:37:32', '3d3f9e0a-7b98-4289-86dc-7e6f51c4740c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13023, N'select', 0, N'SELECT ##COLUMNS## FROM Analytics_Campaign WHERE [CampaignID] = @ID', 0, 2890, 0, '20110914 16:37:46', '8d728731-80d2-4f71-b91d-44c97744133c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13024, N'delete', 0, N'DELETE FROM Analytics_Campaign WHERE [CampaignID] = @ID', 0, 2890, 0, '20110914 16:37:46', 'ca2660f0-5c76-4ab8-a447-a172569d715d', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13025, N'insert', 0, N'INSERT INTO Analytics_Campaign ([CampaignName], [CampaignDisplayName], [CampaignDescription], [CampaignSiteID], [CampaignImpressions], [CampaignOpenFrom], [CampaignOpenTo], [CampaignRules], [CampaignGUID], [CampaignLastModified], [CampaignUseAllConversions], [CampaignEnabled], [CampaignTotalCost], [CampaignGoalVisitorsMin], [CampaignGoalConversionsMin], [CampaignGoalValueMin], [CampaignGoalPerVisitorMin], [CampaignGoalVisitors], [CampaignGoalConversions], [CampaignGoalValue], [CampaignGoalPerVisitor], [CampaignGoalVisitorsPercent], [CampaignGoalConversionsPercent], [CampaignGoalValuePercent], [CampaignGoalPerVisitorPercent] ) VALUES ( @CampaignName, @CampaignDisplayName, @CampaignDescription, @CampaignSiteID, @CampaignImpressions, @CampaignOpenFrom, @CampaignOpenTo, @CampaignRules, @CampaignGUID, @CampaignLastModified, @CampaignUseAllConversions, @CampaignEnabled, @CampaignTotalCost, @CampaignGoalVisitorsMin, @CampaignGoalConversionsMin, @CampaignGoalValueMin, @CampaignGoalPerVisitorMin, @CampaignGoalVisitors, @CampaignGoalConversions, @CampaignGoalValue, @CampaignGoalPerVisitor, @CampaignGoalVisitorsPercent, @CampaignGoalConversionsPercent, @CampaignGoalValuePercent, @CampaignGoalPerVisitorPercent); SELECT SCOPE_IDENTITY() AS [CampaignID]', 1, 2890, 0, '20110914 16:37:46', '007fb8b8-6f0c-409e-9b92-84fd480234a1', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13026, N'update', 0, N'UPDATE Analytics_Campaign SET [CampaignName] = @CampaignName, [CampaignDisplayName] = @CampaignDisplayName, [CampaignDescription] = @CampaignDescription, [CampaignSiteID] = @CampaignSiteID, [CampaignImpressions] = @CampaignImpressions, [CampaignOpenFrom] = @CampaignOpenFrom, [CampaignOpenTo] = @CampaignOpenTo, [CampaignRules] = @CampaignRules, [CampaignGUID] = @CampaignGUID, [CampaignLastModified] = @CampaignLastModified, [CampaignUseAllConversions] = @CampaignUseAllConversions, [CampaignEnabled] = @CampaignEnabled, [CampaignTotalCost] = @CampaignTotalCost, [CampaignGoalVisitorsMin] = @CampaignGoalVisitorsMin, [CampaignGoalConversionsMin] = @CampaignGoalConversionsMin, [CampaignGoalValueMin] = @CampaignGoalValueMin, [CampaignGoalPerVisitorMin] = @CampaignGoalPerVisitorMin, [CampaignGoalVisitors] = @CampaignGoalVisitors, [CampaignGoalConversions] = @CampaignGoalConversions, [CampaignGoalValue] = @CampaignGoalValue, [CampaignGoalPerVisitor] = @CampaignGoalPerVisitor, [CampaignGoalVisitorsPercent] = @CampaignGoalVisitorsPercent, [CampaignGoalConversionsPercent] = @CampaignGoalConversionsPercent, [CampaignGoalValuePercent] = @CampaignGoalValuePercent, [CampaignGoalPerVisitorPercent] = @CampaignGoalPerVisitorPercent WHERE [CampaignID] = @CampaignID', 0, 2890, 0, '20110914 16:37:46', 'c66b03d0-9c30-4fb4-b394-a868775bdfc2', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13027, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Analytics_Campaign WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2890, 0, '20110914 16:37:46', '71e0916a-69fc-4730-81a1-93dbcb9932cd', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13039, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Analytics_Campaign WHERE (CampaignLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 2890, 0, '20110914 16:37:46', '7db86a46-1741-400f-8cee-ed7daa2825db', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13028, N'deleteall', 0, N'DELETE FROM Analytics_Campaign WHERE ##WHERE##', 0, 2890, 0, '20110914 16:37:46', '83f738e8-ce45-4973-9648-50cc62d99a66', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13029, N'updateall', 0, N'UPDATE Analytics_Campaign SET ##COLUMNS## WHERE ##WHERE##', 0, 2890, 0, '20110914 16:37:46', 'a9844360-02ee-47ae-aa62-14c5ea0b23ae', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12348, N'select', 0, N'SELECT ##COLUMNS## FROM OM_MVTest WHERE [MVTestID] = @ID', 0, 2806, 0, '20110914 16:38:01', '25393845-5377-4a8e-a99a-1d923b4474b0', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12349, N'delete', 0, N'DELETE FROM OM_MVTest WHERE [MVTestID] = @ID', 0, 2806, 0, '20110914 16:38:01', 'c623d374-284f-40d9-ab2a-b729b5b5d31c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12350, N'insert', 0, N'INSERT INTO OM_MVTest ([MVTestName], [MVTestDescription], [MVTestPage], [MVTestSiteID], [MVTestCulture], [MVTestOpenFrom], [MVTestOpenTo], [MVTestMaxConversions], [MVTestConversions], [MVTestTargetConversionType], [MVTestGUID], [MVTestLastModified], [MVTestEnabled], [MVTestDisplayName] ) VALUES ( @MVTestName, @MVTestDescription, @MVTestPage, @MVTestSiteID, @MVTestCulture, @MVTestOpenFrom, @MVTestOpenTo, @MVTestMaxConversions, @MVTestConversions, @MVTestTargetConversionType, @MVTestGUID, @MVTestLastModified, @MVTestEnabled, @MVTestDisplayName); SELECT SCOPE_IDENTITY() AS [MVTestID]', 1, 2806, 0, '20110914 16:38:01', '5f1b085a-48f6-4365-aad4-f9c38f3134b8', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12351, N'update', 0, N'UPDATE OM_MVTest SET [MVTestName] = @MVTestName, [MVTestDescription] = @MVTestDescription, [MVTestPage] = @MVTestPage, [MVTestSiteID] = @MVTestSiteID, [MVTestCulture] = @MVTestCulture, [MVTestOpenFrom] = @MVTestOpenFrom, [MVTestOpenTo] = @MVTestOpenTo, [MVTestMaxConversions] = @MVTestMaxConversions, [MVTestConversions] = @MVTestConversions, [MVTestTargetConversionType] = @MVTestTargetConversionType, [MVTestGUID] = @MVTestGUID, [MVTestLastModified] = @MVTestLastModified, [MVTestEnabled] = @MVTestEnabled, [MVTestDisplayName] = @MVTestDisplayName WHERE [MVTestID] = @MVTestID', 0, 2806, 0, '20110914 16:38:01', 'aea725fe-d103-4e76-b604-e2d9dfa80b49', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12352, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_MVTest WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2806, 0, '20110914 16:38:01', '2f091450-76b8-4ad6-8bae-51c3ac63c337', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12397, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_MVTest WHERE (MVTestLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 2806, 0, '20110914 16:38:01', '8e3e6a6f-566b-41c9-9cc4-9c7a1832a602', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12353, N'deleteall', 0, N'DELETE FROM OM_MVTest WHERE ##WHERE##', 0, 2806, 0, '20110914 16:38:01', '508eeb1d-2741-4c0f-b2cf-6ffc93b7116c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12354, N'updateall', 0, N'UPDATE OM_MVTest SET ##COLUMNS## WHERE ##WHERE##', 0, 2806, 0, '20110914 16:38:01', 'a86f7b8a-f7e5-41b2-b1cb-29122b1959eb', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12355, N'select', 0, N'SELECT ##COLUMNS## FROM OM_MVTVariant WHERE [MVTVariantID] = @ID', 0, 2807, 0, '20110914 16:38:29', '1f09943b-1e0f-4aec-aed9-996d904d993c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12356, N'delete', 0, N'DELETE FROM OM_MVTVariant WHERE [MVTVariantID] = @ID', 0, 2807, 0, '20110914 16:38:29', '87c6c167-ed83-449f-8aec-20e44356b3bf', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12357, N'insert', 0, N'INSERT INTO OM_MVTVariant ([MVTVariantName], [MVTVariantDisplayName], [MVTVariantInstanceGUID], [MVTVariantZoneID], [MVTVariantPageTemplateID], [MVTVariantEnabled], [MVTVariantWebParts], [MVTVariantGUID], [MVTVariantLastModified], [MVTVariantDescription], [MVTVariantDocumentID] ) VALUES ( @MVTVariantName, @MVTVariantDisplayName, @MVTVariantInstanceGUID, @MVTVariantZoneID, @MVTVariantPageTemplateID, @MVTVariantEnabled, @MVTVariantWebParts, @MVTVariantGUID, @MVTVariantLastModified, @MVTVariantDescription, @MVTVariantDocumentID); SELECT SCOPE_IDENTITY() AS [MVTVariantID]', 1, 2807, 0, '20110914 16:38:29', '9a4f2500-c144-4964-8216-f33cb3aa1734', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12358, N'update', 0, N'UPDATE OM_MVTVariant SET [MVTVariantName] = @MVTVariantName, [MVTVariantDisplayName] = @MVTVariantDisplayName, [MVTVariantInstanceGUID] = @MVTVariantInstanceGUID, [MVTVariantZoneID] = @MVTVariantZoneID, [MVTVariantPageTemplateID] = @MVTVariantPageTemplateID, [MVTVariantEnabled] = @MVTVariantEnabled, [MVTVariantWebParts] = @MVTVariantWebParts, [MVTVariantGUID] = @MVTVariantGUID, [MVTVariantLastModified] = @MVTVariantLastModified, [MVTVariantDescription] = @MVTVariantDescription, [MVTVariantDocumentID] = @MVTVariantDocumentID WHERE [MVTVariantID] = @MVTVariantID', 0, 2807, 0, '20110914 16:38:29', '7320b669-aa11-4bc7-9030-e04013a40c39', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12359, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_MVTVariant WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2807, 0, '20110914 16:38:29', '33844191-78ea-4b4f-b6cd-762a9e468e42', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12743, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_MVTVariant WHERE (MVTVariantLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 2807, 0, '20110914 16:38:29', 'b99720b9-a6bf-4bf6-949d-b15698055891', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12360, N'deleteall', 0, N'DELETE FROM OM_MVTVariant WHERE ##WHERE##', 0, 2807, 0, '20110914 16:38:29', 'cc8b00bd-f020-4f0c-9f75-3b04eaffd99f', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12361, N'updateall', 0, N'UPDATE OM_MVTVariant SET ##COLUMNS## WHERE ##WHERE##', 0, 2807, 0, '20110914 16:38:29', 'bfc5f27b-e73e-4f3b-88cd-99cce9a4ab7c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13125, N'selectfromcontactview', 0, N'SELECT ##TOPN## ##COLUMNS## FROM View_OM_ContactGroupMember_ContactJoined WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2852, 0, '20110915 13:06:39', '080df39f-decb-4ab5-b3ce-a650b015f6ae', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2475, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Forums_Forum WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 1122, 0, '20110915 14:36:15', '2960f27a-ae8b-4ab8-8d76-cf269630519e', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13085, N'deleteall', 0, N'DELETE FROM Forums_Forum WHERE ##WHERE##', 0, 1122, 0, '20110915 14:36:15', '3fa9dc57-f0f6-4179-a487-4b5152338c89', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13086, N'updateall', 0, N'UPDATE Forums_Forum SET ##COLUMNS## WHERE ##WHERE##', 0, 1122, 0, '20110915 14:36:15', '1ed3d815-8193-4a6a-b0ee-669531c60183', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2813, N'selectlist', 0, N'SELECT ##TOPN## ##COLUMNS## FROM COM_SKU LEFT JOIN COM_PublicStatus ON COM_SKU.SKUPublicStatusID = COM_PublicStatus.PublicStatusID LEFT JOIN COM_InternalStatus ON COM_SKU.SKUInternalStatusID = COM_InternalStatus.InternalStatusID WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 1159, 0, '20110916 16:47:27', 'a142d3a2-d062-4393-852f-2e0911023c16', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (220, N'select', 0, N'SELECT ##COLUMNS## FROM CMS_Document WHERE [DocumentID] = @ID', 0, 144, 0, '20110917 15:16:49', '922dc61c-fc85-43e0-8967-1fb0c4d054fd', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6019, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM CMS_Document WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 144, 0, '20110917 15:16:49', 'a22cd843-7a76-4d2b-bfa6-7ce118357676', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7343, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM CMS_Document WHERE (DocumentModifiedWhen >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 144, 0, '20110917 15:16:49', '8795a625-3c9f-4e29-8262-1f21b6347159', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (11968, N'deleteall', 0, N'DELETE FROM CMS_Document WHERE ##WHERE##', 0, 144, 0, '20110917 15:16:49', '3fdedc3b-aeab-48c1-83ea-3f7b11e37c4b', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (11969, N'updateall', 0, N'UPDATE CMS_Document SET ##COLUMNS## WHERE ##WHERE##', 0, 144, 0, '20110917 15:16:49', 'a396caef-232c-4a2e-b2d2-7b998ffb62a5', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12892, N'selectfromview', 0, N'SELECT ##TOPN## ##COLUMNS## FROM
(SELECT *,
ISNULL(OM_Contact.ContactFirstName,'''') +
CASE OM_Contact.ContactFirstName
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '' ''
END
+ ISNULL(OM_Contact.ContactMiddleName,'''') +
CASE OM_Contact.ContactMiddleName
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '' ''
END
+ ISNULL(OM_Contact.ContactLastName, '''') AS ContactFullNameJoined,
ISNULL(OM_Contact.ContactAddress1,'''') +
CASE OM_Contact.ContactAddress1
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '', ''
END
+ ISNULL(OM_Contact.ContactAddress2,'''') +
CASE OM_Contact.ContactAddress2
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '', ''
END
+ ISNULL(OM_Contact.ContactCity, '''') AS ContactFullAddressJoined
FROM OM_Contact) as OM_Contact
WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2841, 1, '20110929 14:19:36', '39a06158-cdec-4cfc-b486-2324acf702fa', 0, 1)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12984, N'insert', 0, N'INSERT INTO Integration_Connector ([ConnectorName], [ConnectorDisplayName], [ConnectorAssemblyName], [ConnectorClassName], [ConnectorEnabled], [ConnectorLastModified] ) VALUES ( @ConnectorName, @ConnectorDisplayName, @ConnectorAssemblyName, @ConnectorClassName, @ConnectorEnabled, @ConnectorLastModified); SELECT SCOPE_IDENTITY() AS [ConnectorID]', 1, 2884, 0, '20111003 12:28:26', 'f2b6586d-77a8-4cd1-a943-ca4d7e249b94', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12985, N'update', 0, N'UPDATE Integration_Connector SET [ConnectorName] = @ConnectorName, [ConnectorDisplayName] = @ConnectorDisplayName, [ConnectorAssemblyName] = @ConnectorAssemblyName, [ConnectorClassName] = @ConnectorClassName, [ConnectorEnabled] = @ConnectorEnabled, [ConnectorLastModified] = @ConnectorLastModified WHERE [ConnectorID] = @ConnectorID', 0, 2884, 0, '20111003 12:28:35', 'c93c0bca-e7b5-450e-9b80-143e787210fc', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13372, N'select', 0, N'SELECT ##COLUMNS## FROM OM_PersonalizationVariant WHERE [VariantID] = @ID', 0, 2921, 0, '20111003 17:21:57', 'e4a14744-bcf4-40cf-a28a-42e95009df58', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13373, N'delete', 0, N'DELETE FROM OM_PersonalizationVariant WHERE [VariantID] = @ID', 0, 2921, 0, '20111003 17:21:57', 'a55b057c-10d0-4a86-9198-f70e734c15b5', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13374, N'insert', 0, N'INSERT INTO OM_PersonalizationVariant ([VariantEnabled], [VariantName], [VariantDisplayName], [VariantInstanceGUID], [VariantZoneID], [VariantPageTemplateID], [VariantWebParts], [VariantPosition], [VariantGUID], [VariantLastModified], [VariantDescription], [VariantDocumentID], [VariantDisplayCondition] ) VALUES ( @VariantEnabled, @VariantName, @VariantDisplayName, @VariantInstanceGUID, @VariantZoneID, @VariantPageTemplateID, @VariantWebParts, @VariantPosition, @VariantGUID, @VariantLastModified, @VariantDescription, @VariantDocumentID, @VariantDisplayCondition); SELECT SCOPE_IDENTITY() AS [VariantID]', 1, 2921, 0, '20111003 17:21:57', '16215a1d-0963-4cce-adc9-0397660426d2', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13375, N'update', 0, N'UPDATE OM_PersonalizationVariant SET [VariantEnabled] = @VariantEnabled, [VariantName] = @VariantName, [VariantDisplayName] = @VariantDisplayName, [VariantInstanceGUID] = @VariantInstanceGUID, [VariantZoneID] = @VariantZoneID, [VariantPageTemplateID] = @VariantPageTemplateID, [VariantWebParts] = @VariantWebParts, [VariantPosition] = @VariantPosition, [VariantGUID] = @VariantGUID, [VariantLastModified] = @VariantLastModified, [VariantDescription] = @VariantDescription, [VariantDocumentID] = @VariantDocumentID, [VariantDisplayCondition] = @VariantDisplayCondition WHERE [VariantID] = @VariantID', 0, 2921, 0, '20111003 17:21:57', 'be05963b-2005-4b12-ae94-5ac32d82b234', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13376, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_PersonalizationVariant WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2921, 0, '20111003 17:21:57', '0bb78786-4d03-4615-8381-b2a5fdfc6d85', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13381, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_PersonalizationVariant WHERE (VariantLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 2921, 0, '20111003 17:21:57', '6266bc56-8669-4530-a5ff-9b383bbef1bf', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13377, N'deleteall', 0, N'DELETE FROM OM_PersonalizationVariant WHERE ##WHERE##', 0, 2921, 0, '20111003 17:21:57', 'c4f3444e-d5e4-499b-b641-02a508640bec', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13378, N'updateall', 0, N'UPDATE OM_PersonalizationVariant SET ##COLUMNS## WHERE ##WHERE##', 0, 2921, 0, '20111003 17:21:57', '6c4f210a-949c-4b1b-b072-85594d37078c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (856, N'select', 0, N'SELECT ##COLUMNS## FROM CMS_AttachmentHistory WHERE [AttachmentHistoryID] = @ID', 0, 516, 0, '20111006 02:12:00', '35b6eb28-8668-4854-a5cc-4ae0bf050aed', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5162, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM CMS_AttachmentHistory WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 516, 0, '20111006 02:12:00', 'bd405c44-465a-48e9-b8ce-bbd1c82d63d3', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7614, N'selectnobinary', 0, N'SELECT [AttachmentHistoryID], [AttachmentName], [AttachmentExtension], [AttachmentSize], [AttachmentMimeType], [AttachmentImageWidth], [AttachmentImageHeight], [AttachmentDocumentID], [AttachmentGUID], [AttachmentIsUnsorted], [AttachmentOrder], [AttachmentGroupGUID], [AttachmentHash], [AttachmentTitle], [AttachmentDescription], [AttachmentCustomData], [AttachmentLastModified] FROM CMS_AttachmentHistory WHERE [AttachmentHistoryID] = @ID', 0, 516, 0, '20111006 02:12:00', '6dca814d-eab1-4cc6-b24d-474fd593027b', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5213, N'selectallnobinary', 0, N'SELECT ##TOPN## [AttachmentHistoryID], [AttachmentName], [AttachmentExtension], [AttachmentSize], [AttachmentMimeType], [AttachmentImageWidth], [AttachmentImageHeight], [AttachmentDocumentID], [AttachmentGUID], [AttachmentIsUnsorted], [AttachmentOrder], [AttachmentGroupGUID], [AttachmentHash], [AttachmentTitle], [AttachmentDescription], [AttachmentCustomData], [AttachmentLastModified] ##COLUMNS## FROM CMS_AttachmentHistory WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 516, 0, '20111006 02:12:00', '0763b004-18de-4da5-bb7d-744cffaac363', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13129, N'deleteall', 0, N'DELETE FROM CMS_AttachmentHistory WHERE ##WHERE##', 0, 516, 0, '20111006 02:12:00', '5f3f8619-5fc7-4860-bc16-a3631b131ec3', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13130, N'updateall', 0, N'UPDATE CMS_AttachmentHistory SET ##COLUMNS## WHERE ##WHERE##', 0, 516, 0, '20111006 02:12:00', '6ac12a2c-ff69-455f-84fa-90429822a769', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (795, N'select', 0, N'SELECT ##COLUMNS## FROM CMS_Attachment WHERE [AttachmentID] = @ID', 0, 504, 0, '20111006 02:13:44', '3e3188e2-5067-4066-a427-79fc165b5a66', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5056, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM CMS_Attachment WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 504, 0, '20111006 02:13:44', '4180b7be-df22-4cb2-bd52-f8049d4e2a19', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4998, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM CMS_Attachment WHERE (AttachmentLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 504, 0, '20111006 02:13:44', 'abc061d6-e6fc-4c33-8ece-2a76f4e3d523', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4648, N'selectnobinary', 0, N'SELECT [AttachmentID], [AttachmentName], [AttachmentExtension], [AttachmentSize], [AttachmentMimeType], [AttachmentImageWidth], [AttachmentImageHeight], [AttachmentDocumentID], [AttachmentGUID], [AttachmentLastHistoryID], [AttachmentSiteID], [AttachmentLastModified], [AttachmentIsUnsorted], [AttachmentOrder], [AttachmentGroupGUID], [AttachmentFormGUID], [AttachmentHash], [AttachmentTitle], [AttachmentDescription], [AttachmentCustomData] FROM CMS_Attachment WHERE [AttachmentID] = @ID', 0, 504, 0, '20111006 02:13:44', '50e47a93-57e8-4d37-8af2-6478c50095db', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5058, N'selectallnobinary', 0, N'SELECT ##TOPN## [AttachmentID], [AttachmentName], [AttachmentExtension], [AttachmentSize], [AttachmentMimeType], [AttachmentImageWidth], [AttachmentImageHeight], [AttachmentDocumentID], [AttachmentGUID], [AttachmentLastHistoryID], [AttachmentSiteID], [AttachmentLastModified], [AttachmentIsUnsorted], [AttachmentOrder], [AttachmentGroupGUID], [AttachmentFormGUID], [AttachmentHash], [AttachmentTitle], [AttachmentDescription], [AttachmentCustomData] ##COLUMNS## FROM CMS_Attachment WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 504, 0, '20111006 02:13:44', '58eaa6b7-7a49-4f7f-b09b-65f8b2ca64ed', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12586, N'deleteall', 0, N'DELETE FROM CMS_Attachment WHERE ##WHERE##', 0, 504, 0, '20111006 02:13:44', '4ac54a86-62c9-4853-90a2-81e0be848c9a', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12587, N'updateall', 0, N'UPDATE CMS_Attachment SET ##COLUMNS## WHERE ##WHERE##', 0, 504, 0, '20111006 02:13:44', '7d7c52ad-5d7b-46ca-bfe8-a23cc3bc0211', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12694, N'select', 0, N'SELECT ##COLUMNS## FROM OM_Activity WHERE [ActivityID] = @ID', 0, 2854, 0, '20111006 09:53:01', 'b82954ab-9d24-41a9-92ae-aad1fd62b87e', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12695, N'delete', 0, N'DELETE FROM OM_Activity WHERE [ActivityID] = @ID', 0, 2854, 0, '20111006 09:53:01', '5bd507da-b6f3-4b83-86e1-117c073afa04', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12696, N'insert', 0, N'INSERT INTO OM_Activity ([ActivityActiveContactID], [ActivityOriginalContactID], [ActivityCreated], [ActivityType], [ActivityItemID], [ActivityItemDetailID], [ActivityValue], [ActivityURL], [ActivityTitle], [ActivitySiteID], [ActivityGUID], [ActivityIPAddress], [ActivityComment], [ActivityCampaign], [ActivityURLReferrer], [ActivityCulture], [ActivityNodeID] ) VALUES ( @ActivityActiveContactID, @ActivityOriginalContactID, @ActivityCreated, @ActivityType, @ActivityItemID, @ActivityItemDetailID, @ActivityValue, @ActivityURL, @ActivityTitle, @ActivitySiteID, @ActivityGUID, @ActivityIPAddress, @ActivityComment, @ActivityCampaign, @ActivityURLReferrer, @ActivityCulture, @ActivityNodeID); SELECT SCOPE_IDENTITY() AS [ActivityID]', 1, 2854, 0, '20111006 09:53:01', '2c4d6ece-2cb9-4097-8529-60997631ffba', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12697, N'update', 0, N'UPDATE OM_Activity SET [ActivityActiveContactID] = @ActivityActiveContactID, [ActivityOriginalContactID] = @ActivityOriginalContactID, [ActivityCreated] = @ActivityCreated, [ActivityType] = @ActivityType, [ActivityItemID] = @ActivityItemID, [ActivityItemDetailID] = @ActivityItemDetailID, [ActivityValue] = @ActivityValue, [ActivityURL] = @ActivityURL, [ActivityTitle] = @ActivityTitle, [ActivitySiteID] = @ActivitySiteID, [ActivityGUID] = @ActivityGUID, [ActivityIPAddress] = @ActivityIPAddress, [ActivityComment] = @ActivityComment, [ActivityCampaign] = @ActivityCampaign, [ActivityURLReferrer] = @ActivityURLReferrer, [ActivityCulture] = @ActivityCulture, [ActivityNodeID] = @ActivityNodeID WHERE [ActivityID] = @ActivityID', 0, 2854, 0, '20111006 09:53:01', '2750470b-6236-49ec-a67a-be0a4a6e503d', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12698, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM OM_Activity WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2854, 0, '20111006 09:53:01', '9416adef-0196-4f27-a58e-2859e1455072', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12699, N'deleteall', 0, N'DELETE FROM OM_Activity WHERE ##WHERE##', 0, 2854, 0, '20111006 09:53:01', '21a57102-e1bb-4310-a55e-c49c5c7e0e6f', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12700, N'updateall', 0, N'UPDATE OM_Activity SET ##COLUMNS## WHERE ##WHERE##', 0, 2854, 0, '20111006 09:53:01', '63b9ac8a-bb78-44d6-8b82-bd445ca3363f', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13038, N'SelectWithViews', 0, N'SELECT ##COLUMNS## FROM 
(SELECT Analytics_Conversion.*,StatisticsObjectName, SUM (HitsCount) AS HitsCount,SUM(HitsValue) AS HitsValues FROM
Analytics_Conversion 
LEFT JOIN Analytics_Statistics ON StatisticsCode = ''conversion'' AND StatisticsObjectName = ConversionName
LEFT JOIN Analytics_YearHits ON Analytics_Statistics.StatisticsID = Analytics_YearHits.HitsStatisticsID
WHERE ##WHERE## GROUP BY ConversionLastModified,ConversionSiteID,
ConversionGUID,ConversionDescription,ConversionName,ConversionID,ConversionDisplayName,StatisticsObjectName ORDER BY ##ORDERBY##) AS X', 0, 2889, 0, '20111006 14:27:16', 'e221cdc3-e275-4b70-9b1f-24dede283e80', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12311, N'selectwithhits', 0, N'SELECT ##COLUMNS##
  FROM (SELECT ABTestID,ABTestName, ABTestDisplayName, ABTestSiteID,  ABTestCulture, ABTestOriginalPage, ABTestOpenFrom, ABTestOpenTo, ABTestEnabled, ABTestConversions, SUM (HitsValue) AS HitsValue FROM OM_ABTest 
LEFT OUTER JOIN Analytics_Statistics ON Analytics_Statistics.StatisticsCode LIKE ''abconversion;''+ ABTestName+ '';%'' 
LEFT OUTER JOIN Analytics_YearHits ON Analytics_Statistics.StatisticsID = Analytics_YearHits.HitsStatisticsID
GROUP BY ABTestName, ABTestDisplayName, ABTestID, ABTestCulture, ABTestOriginalPage, ABTestOpenFrom, ABTestOpenTo, ABTestEnabled, ABTestConversions, ABTestSiteID) AS X
WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2491, 0, '20111006 14:55:29', '331dceff-75d7-4d49-9735-713b9b476771', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13357, N'selectbyrelatedidandtype', 0, N'SELECT ActiveContactID AS ContactID FROM OM_Membership m WHERE m.RelatedID=@RelatedID AND m.MemberType=@MemberType AND EXISTS(SELECT ContactID FROM OM_Contact WHERE ContactID=m.ActiveContactID AND ContactSiteID=@SiteID AND ##WHERE##) ORDER BY ActiveContactID', 0, 2853, 0, '20111014 09:47:01', '429cd783-9ee2-4e07-9c1d-5ae0f08a5360', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13267, N'GetCombinationsWithoutZone', 0, N'IF (@MVTVariantDocumentID = 0)
BEGIN
  SET @MVTVariantDocumentID = NULL;
END
SELECT *
FROM OM_MVTCombination
WHERE
  (MVTCombinationPageTemplateID = @MVTCombinationPageTemplateID)
  AND
  ((MVTCombinationDocumentID IS NULL) OR (MVTCombinationDocumentID = COALESCE(@MVTVariantDocumentID, MVTCombinationDocumentID)))
  AND
  MVTCombinationID NOT IN
  (
    SELECT MVTCombinationID
    FROM OM_MVTCombinationVariation
    WHERE
      MVTVariantID IN
      (
        SELECT MVTVariantID
        FROM OM_MVTVariant
        WHERE
          (MVTVariantZoneID = @MVTVariantZoneID) AND
          (MVTVariantPageTemplateID= @MVTCombinationPageTemplateID)
      )
  )', 0, 2808, 0, '20111019 09:07:43', 'de03c60d-09f6-4c92-93a3-0940cf7378be', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12804, N'GetCombinationsWithoutWebpart', 0, N'IF (@MVTVariantDocumentID = 0)
BEGIN
  SET @MVTVariantDocumentID = NULL;
END
SELECT *
FROM OM_MVTCombination
WHERE
  (MVTCombinationPageTemplateID = @MVTCombinationPageTemplateID)
  AND 
  ((MVTCombinationDocumentID IS NULL) OR (MVTCombinationDocumentID = COALESCE(@MVTVariantDocumentID, MVTCombinationDocumentID)))
  AND
  MVTCombinationID NOT IN
  (
    SELECT MVTCombinationID
    FROM OM_MVTCombinationVariation
    WHERE
      MVTVariantID IN
      (
        SELECT MVTVariantID
        FROM OM_MVTVariant
        WHERE
          MVTVariantInstanceGUID = @MVTVariantInstanceGUID
      )
  )', 0, 2808, 0, '20111019 09:07:55', '90b9f171-34af-4b2a-ace2-e27bfbead909', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (3366, N'selectallofsite', 0, N'SELECT * FROM Polls_Poll WHERE (PollID IN (SELECT PollID FROM Polls_PollSite WHERE SiteID=@SiteID) OR PollID IN (SELECT PollID FROM Polls_Poll WHERE PollSiteID=@SiteID)) ORDER BY ##ORDERBY##', 0, 1330, 0, '20111020 16:39:33', 'cd685f8b-8216-461a-8acf-9e9570cca3b4', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (65, N'select', 0, N'SELECT ##COLUMNS## FROM CMS_User WHERE [UserID] = @ID', 0, 59, 0, '20111021 17:16:48', 'de2dccd4-aca7-4281-b5a9-b757ecc57431', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (66, N'delete', 0, N'DELETE FROM CMS_User WHERE [UserID] = @ID', 0, 59, 0, '20111021 17:16:48', '7b0aed8e-d65e-4935-a3ac-0584530e396f', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (67, N'insert', 0, N'INSERT INTO CMS_User ([UserName], [FirstName], [MiddleName], [LastName], [FullName], [Email], [UserPassword], [PreferredCultureCode], [PreferredUICultureCode], [UserEnabled], [UserIsEditor], [UserIsGlobalAdministrator], [UserIsExternal], [UserPasswordFormat], [UserCreated], [LastLogon], [UserStartingAliasPath], [UserGUID], [UserLastModified], [UserLastLogonInfo], [UserIsHidden], [UserVisibility], [UserIsDomain], [UserHasAllowedCultures], [UserSiteManagerDisabled] ) VALUES ( @UserName, @FirstName, @MiddleName, @LastName, @FullName, @Email, @UserPassword, @PreferredCultureCode, @PreferredUICultureCode, @UserEnabled, @UserIsEditor, @UserIsGlobalAdministrator, @UserIsExternal, @UserPasswordFormat, @UserCreated, @LastLogon, @UserStartingAliasPath, @UserGUID, @UserLastModified, @UserLastLogonInfo, @UserIsHidden, @UserVisibility, @UserIsDomain, @UserHasAllowedCultures, @UserSiteManagerDisabled); SELECT SCOPE_IDENTITY() AS [UserID]', 1, 59, 0, '20111021 17:16:48', '2db5b9e7-64aa-469a-a33a-1e186c1d1055', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (70, N'update', 0, N'UPDATE CMS_User SET [UserName] = @UserName, [FirstName] = @FirstName, [MiddleName] = @MiddleName, [LastName] = @LastName, [FullName] = @FullName, [Email] = @Email, [UserPassword] = @UserPassword, [PreferredCultureCode] = @PreferredCultureCode, [PreferredUICultureCode] = @PreferredUICultureCode, [UserEnabled] = @UserEnabled, [UserIsEditor] = @UserIsEditor, [UserIsGlobalAdministrator] = @UserIsGlobalAdministrator, [UserIsExternal] = @UserIsExternal, [UserPasswordFormat] = @UserPasswordFormat, [UserCreated] = @UserCreated, [LastLogon] = @LastLogon, [UserStartingAliasPath] = @UserStartingAliasPath, [UserGUID] = @UserGUID, [UserLastModified] = @UserLastModified, [UserLastLogonInfo] = @UserLastLogonInfo, [UserIsHidden] = @UserIsHidden, [UserVisibility] = @UserVisibility, [UserIsDomain] = @UserIsDomain, [UserHasAllowedCultures] = @UserHasAllowedCultures, [UserSiteManagerDisabled] = @UserSiteManagerDisabled WHERE [UserID] = @UserID', 0, 59, 0, '20111021 17:16:48', '153f1e30-1a43-4f7a-a630-a35669d564a3', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (121, N'selectall', 0, N'SELECT ##TOPN## ##COLUMNS## FROM CMS_User WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 59, 0, '20111021 17:16:48', '80920f99-1bd2-4f95-9fc0-8f847ad11fe3', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4861, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM CMS_User WHERE (UserLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 59, 0, '20111021 17:16:48', '145d85f4-a408-4e2a-9310-ba8631e3f3c0', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12243, N'deleteall', 0, N'DELETE FROM CMS_User WHERE ##WHERE##', 0, 59, 0, '20111021 17:16:48', '9add85ba-e4f2-46b0-92a3-b3ff3aa8fa33', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12244, N'updateall', 0, N'UPDATE CMS_User SET ##COLUMNS## WHERE ##WHERE##', 0, 59, 0, '20111021 17:16:48', '962f94ab-4d69-4674-a16b-118b6ade0e47', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13291, N'selectcustomers', 0, N'SELECT ##TOPN## ##COLUMNS## FROM (
SELECT ContactID, MembershipID, ActiveContactID, OriginalContactID, CustomerFirstName, CustomerLastName, CustomerEmail, CustomerCompany, 
ContactMergedWithContactID, OM_Contact.ContactSiteID,
ISNULL(OM_Contact.ContactFirstName,'''') +
CASE OM_Contact.ContactFirstName
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '' ''
END
+ ISNULL(OM_Contact.ContactMiddleName,'''') +
CASE OM_Contact.ContactMiddleName
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '' ''
END
+ ISNULL(OM_Contact.ContactLastName, '''') AS ContactFullNameJoined
FROM OM_Membership
INNER JOIN OM_Contact ON OM_Membership.OriginalContactID=OM_Contact.ContactID
INNER JOIN COM_Customer ON OM_Membership.RelatedID=COM_Customer.CustomerID
WHERE ActiveContactID=@ContactID AND MemberType=1) as tab
WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2853, 0, '20111026 13:52:44', 'd31e3523-f7a8-4bd3-b389-e59f05d19704', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13297, N'selectglobalcustomers', 0, N'SELECT ##TOPN## ##COLUMNS## FROM (
SELECT ContactID, MembershipID, ActiveContactID, OriginalContactID, RelatedID,
ContactMergedWithContactID, OM_Contact.ContactSiteID, ISNULL(OM_Contact.ContactFirstName,'''') +
CASE OM_Contact.ContactFirstName
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '' ''
END
+ ISNULL(OM_Contact.ContactMiddleName,'''') +
CASE OM_Contact.ContactMiddleName
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '' ''
END
+ ISNULL(OM_Contact.ContactLastName, '''') AS ContactFullNameJoined
FROM OM_Membership
INNER JOIN OM_Contact ON OM_Membership.OriginalContactID=OM_Contact.ContactID
WHERE ContactID IN (SELECT * FROM Func_OM_Contact_GetChildren(@ContactID, 1)) AND MemberType=1) as tab
WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2853, 0, '20111027 16:03:48', 'a837dbd3-bd0c-4769-bef6-9473761edc9c', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13290, N'selectmergedcustomers', 0, N'SELECT ##TOPN## ##COLUMNS## FROM (
SELECT ContactID, MembershipID, ActiveContactID, OriginalContactID, ContactMergedWithContactID, CustomerCompany, 
CustomerFirstName, CustomerLastName, CustomerEmail, OM_Contact.ContactSiteID,
ISNULL(OM_Contact.ContactFirstName,'''') +
CASE OM_Contact.ContactFirstName
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '' ''
END
+ ISNULL(OM_Contact.ContactMiddleName,'''') +
CASE OM_Contact.ContactMiddleName
  WHEN '''' THEN ''''
  WHEN NULL THEN ''''
  ELSE '' ''
END
+ ISNULL(OM_Contact.ContactLastName, '''') AS ContactFullNameJoined
FROM OM_Membership
INNER JOIN OM_Contact ON OM_Membership.OriginalContactID=OM_Contact.ContactID
INNER JOIN COM_Customer ON OM_Membership.RelatedID=COM_Customer.CustomerID
WHERE MemberType=1 AND OriginalContactID IN (SELECT * FROM Func_OM_Contact_GetChildren(@ContactID, 1))) as tab
WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 2853, 0, '20111027 16:04:15', '7f104d1a-79f2-413b-b08e-430ee224ebab', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13809, N'removedependencies', 1, N'Proc_CMS_State_RemoveDependencies', 0, 1126, 0, '20111214 09:00:03', '065081a4-76cf-4e19-a42f-1088741178e4', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (12973, N'removeanalyticsdata', 0, N'DECLARE @Year1Start datetime;
    DECLARE @Year1End datetime;
    DECLARE @Year2Start datetime;
    DECLARE @Year2End datetime;
    
    DECLARE @Week1Start datetime;
    DECLARE @Week1End datetime;
    DECLARE @Week2Start datetime;
    DECLARE @Week2End datetime;
    
    DECLARE @Month1Start datetime;
    DECLARE @Month1End datetime;
    DECLARE @Month2Start datetime;
    DECLARE @Month2End datetime;
    		
	-- Trim years
	SET @Year1Start = {%DatabaseSchema%}.Func_Analytics_DateTrim (@From ,''year'');
	SET @Year1End = {%DatabaseSchema%}.Func_Analytics_EndDateTrim (@From ,''year'');
	SET @Year2Start = {%DatabaseSchema%}.Func_Analytics_DateTrim (@To ,''year'');
	SET @Year2End = {%DatabaseSchema%}.Func_Analytics_EndDateTrim (@To ,''year'');	
	
	-- Trim months
	SET @Month1Start = {%DatabaseSchema%}.Func_Analytics_DateTrim (@From ,''month'');
	SET @Month1End = {%DatabaseSchema%}.Func_Analytics_EndDateTrim (@From ,''month'');
	SET @Month2Start = {%DatabaseSchema%}.Func_Analytics_DateTrim (@To ,''month'');
	SET @Month2End = {%DatabaseSchema%}.Func_Analytics_EndDateTrim (@To ,''month'');	
	
	-- Trim week
	SET @Week1Start = {%DatabaseSchema%}.Func_Analytics_DateTrim (@From ,''week'');
	SET @Week1End = {%DatabaseSchema%}.Func_Analytics_EndDateTrim (@From ,''week'');
	SET @Week2Start = {%DatabaseSchema%}.Func_Analytics_DateTrim (@To ,''week'');
	SET @Week2End = {%DatabaseSchema%}.Func_Analytics_EndDateTrim (@To ,''week'');	
SET NOCOUNT ON;
	DECLARE @HitsStatID int;
	DECLARE @Cnt int;
	DECLARE @CntL int;
	DECLARE @CntM int;
	DECLARE @CntR int;
       	DECLARE @ValL int;
	DECLARE @ValM int;
	DECLARE @ValR int;
	DECLARE @hitsID int;
	DECLARE @hitsCount int;
        DECLARE @hitsValue int;
	DECLARE mycursor CURSOR FOR SELECT HitsStatisticsID FROM Analytics_Statistics, Analytics_DayHits
		  WHERE (StatisticsSiteID=@SiteID OR @SiteID = 0) AND  (##WHERE##) AND
		  StatisticsID=HitsStatisticsID AND HitsStartTime >= @From AND
		  @To >= HitsEndTime
	OPEN mycursor;
	FETCH NEXT FROM mycursor INTO @HitsStatID
	WHILE @@FETCH_STATUS = 0
	BEGIN
-- WEEKS
    IF (@Week1End < @To)
    BEGIN
        SET @CntL = 0;
		SELECT @CntL = SUM(HitsCount),@ValL = SUM(HitsValue) FROM Analytics_Statistics, Analytics_DayHits
			  WHERE (##WHERE##) AND StatisticsID=HitsStatisticsID AND
		              HitsStartTime >= @From AND @Week1End >= HitsEndTime AND StatisticsID = @HitsStatID
		GROUP BY StatisticsID, StatisticsObjectName, StatisticsObjectID, StatisticsObjectCulture, HitsStatisticsID
		SET @hitsID = 0;
		SELECT @hitsID = HitsID, @hitsCount = HitsCount,@hitsValue = HitsValue FROM [Analytics_WeekHits]
		WHERE HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Week1Start AND HitsEndTime<=@Week1End;
		IF @hitsID > 0
		BEGIN
			UPDATE [Analytics_WeekHits] SET HitsCount=(@hitsCount-@CntL), HitsValue=(@hitsValue-@ValL) WHERE HitsID=@hitsID;
		END;
    END
    IF (@Week2Start > @From)
    BEGIN
        SET @CntR = 0;
		SELECT @CntR = SUM(HitsCount),@ValR = SUM(HitsValue) FROM Analytics_Statistics, Analytics_DayHits
			  WHERE (##WHERE##) AND StatisticsID=HitsStatisticsID AND
              HitsStartTime >= @Week2Start AND @To >= HitsEndTime AND
              StatisticsID = @HitsStatID
		GROUP BY StatisticsID, StatisticsObjectName, StatisticsObjectID, StatisticsObjectCulture, HitsStatisticsID
		SET @hitsID = 0;
		SELECT @hitsID = HitsID, @hitsCount = HitsCount,@hitsValue = HitsValue FROM [Analytics_WeekHits]
		WHERE HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Week2Start AND HitsEndTime<=@Week2End;
		IF @hitsID > 0
		BEGIN
			UPDATE [Analytics_WeekHits] SET HitsCount=(@hitsCount-@CntR),HitsValue=(@hitsValue-@ValR) WHERE HitsID=@hitsID;
		END;
    END
    IF (@Week1Start <= @From AND @To <= @Week1End)
    BEGIN
        SET @CntM = 0;
		SELECT @CntM = SUM(HitsCount),@ValM = SUM(HitsValue) FROM Analytics_Statistics, Analytics_DayHits
			  WHERE (##WHERE##)  AND StatisticsID=HitsStatisticsID AND
              HitsStartTime >= @From AND @To >= HitsEndTime AND
              StatisticsID = @HitsStatID
		GROUP BY StatisticsID, StatisticsObjectName, StatisticsObjectID, StatisticsObjectCulture, HitsStatisticsID
		SET @hitsID = 0;
		SELECT @hitsID = HitsID, @hitsCount = HitsCount,@hitsValue = HitsValue  FROM [Analytics_WeekHits]
		WHERE HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Week1Start AND HitsEndTime<=@Week1End;
		IF @hitsID > 0
		BEGIN
			UPDATE [Analytics_WeekHits] SET HitsCount=(@hitsCount-@CntM),HitsValue=(@hitsValue-@ValM) WHERE HitsID=@hitsID;
		END;
    END;
-- MONTHS
    IF (@Month1End < @To)
    BEGIN
        SET @CntL = 0;
		SELECT @CntL = SUM(HitsCount),@ValL = SUM(HitsValue) FROM Analytics_Statistics, Analytics_DayHits
			  WHERE (##WHERE##)  AND StatisticsID=HitsStatisticsID AND
              HitsStartTime >= @From AND @Month1End >= HitsEndTime AND
              StatisticsID = @HitsStatID
		GROUP BY StatisticsID, StatisticsObjectName, StatisticsObjectID, StatisticsObjectCulture, HitsStatisticsID
		SET @hitsID = 0;
		SELECT @hitsID = HitsID, @hitsCount = HitsCount,@hitsValue = HitsValue FROM [Analytics_MonthHits]
		WHERE HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Month1Start AND HitsEndTime<=@Month1End;
		IF @hitsID > 0
		BEGIN
			UPDATE [Analytics_MonthHits] SET HitsCount=(@hitsCount-@CntL),HitsValue=(@hitsValue-@ValL) WHERE HitsID=@hitsID;
		END;
    END
    IF (@Month2Start > @From)
    BEGIN
        SET @CntR = 0;
		SELECT @CntR = SUM(HitsCount),@ValR = SUM(HitsValue) FROM Analytics_Statistics, Analytics_DayHits
			  WHERE (##WHERE##)  AND StatisticsID=HitsStatisticsID AND
              HitsStartTime >= @Month2Start AND @To >= HitsEndTime AND
              StatisticsID = @HitsStatID
		GROUP BY StatisticsID, StatisticsObjectName, StatisticsObjectID, StatisticsObjectCulture, HitsStatisticsID
		SET @hitsID = 0;
		SELECT @hitsID = HitsID, @hitsCount = HitsCount,@hitsValue = HitsValue FROM [Analytics_MonthHits]
		WHERE HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Month2Start AND HitsEndTime<=@Month2End;
		IF @hitsID > 0
		BEGIN
			UPDATE [Analytics_MonthHits] SET HitsCount=(@hitsCount-@CntR),HitsValue=(@hitsValue-@ValR) WHERE HitsID=@hitsID;
		END;
    END
    IF (@Month1Start <= @From AND @To <= @Month1End)
    BEGIN
        SET @CntM = 0;
		SELECT @CntM = SUM(HitsCount),@ValM = SUM(HitsValue) FROM Analytics_Statistics, Analytics_DayHits
			  WHERE (##WHERE##)  AND StatisticsID=HitsStatisticsID AND
              HitsStartTime >= @From AND @To >= HitsEndTime AND
              StatisticsID = @HitsStatID
		GROUP BY StatisticsID, StatisticsObjectName, StatisticsObjectID, StatisticsObjectCulture, HitsStatisticsID
		SET @hitsID = 0;
		SELECT @hitsID = HitsID, @hitsCount = HitsCount,@hitsValue = HitsValue FROM [Analytics_MonthHits]
		WHERE HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Month1Start AND HitsEndTime<=@Month1End;
		IF @hitsID > 0
		BEGIN
			UPDATE [Analytics_MonthHits] SET HitsCount=(@hitsCount-@CntM),HitsValue=(@hitsValue-@ValM) WHERE HitsID=@hitsID;
		END;
    END;
-- YEARS
    IF (@Year1End < @To)
    BEGIN
        SET @CntL = 0;
		SELECT @CntL = SUM(HitsCount),@ValL = SUM(HitsValue) FROM Analytics_Statistics, Analytics_DayHits
			  WHERE (##WHERE##)  AND StatisticsID=HitsStatisticsID AND
              HitsStartTime >= @From AND @Year1End >= HitsEndTime AND
              StatisticsID = @HitsStatID
		GROUP BY StatisticsID, StatisticsObjectName, StatisticsObjectID, StatisticsObjectCulture, HitsStatisticsID
		SET @hitsID = 0;
		SELECT @hitsID = HitsID, @hitsCount = HitsCount,@hitsValue = HitsValue FROM [Analytics_YearHits]
		WHERE HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Year1Start AND HitsEndTime<=@Year1End;
		IF @hitsID > 0
		BEGIN
			UPDATE [Analytics_YearHits] SET HitsCount=(@hitsCount-@CntL),HitsValue=(@hitsValue-@ValL) WHERE HitsID=@hitsID;
		END;
    END
    IF (@Year2Start > @From)
    BEGIN
        SET @CntR = 0;
		SELECT @CntR = SUM(HitsCount),@ValR = SUM(HitsValue) FROM Analytics_Statistics, Analytics_DayHits
			  WHERE (##WHERE##)  AND StatisticsID=HitsStatisticsID AND
              HitsStartTime >= @Year2Start AND @To >= HitsEndTime AND
              StatisticsID = @HitsStatID
		GROUP BY StatisticsID, StatisticsObjectName, StatisticsObjectID, StatisticsObjectCulture, HitsStatisticsID
		SET @hitsID = 0;
		SELECT @hitsID = HitsID, @hitsCount = HitsCount,@hitsValue = HitsValue FROM [Analytics_YearHits]
		WHERE HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Year2Start AND HitsEndTime<=@Year2End;
		IF @hitsID > 0
		BEGIN
			UPDATE [Analytics_YearHits] SET HitsCount=(@hitsCount-@CntR),HitsValue=(@hitsValue-@ValR) WHERE HitsID=@hitsID;
		END;
    END
    IF (@Year1Start <= @From AND @To <= @Year1End)
    BEGIN
        SET @CntM = 0;
		SELECT @CntM = SUM(HitsCount),@ValM = SUM(HitsValue) FROM Analytics_Statistics, Analytics_DayHits
			  WHERE (##WHERE##)  AND StatisticsID=HitsStatisticsID AND
              HitsStartTime >= @From AND @To >= HitsEndTime AND
              StatisticsID = @HitsStatID
		GROUP BY StatisticsID, StatisticsObjectName, StatisticsObjectID, StatisticsObjectCulture, HitsStatisticsID
		SET @hitsID = 0;
		SELECT @hitsID = HitsID, @hitsCount = HitsCount,@hitsValue = HitsValue FROM [Analytics_YearHits]
		WHERE HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Year1Start AND HitsEndTime<=@Year1End;
		IF @hitsID > 0
		BEGIN
			UPDATE [Analytics_YearHits] SET HitsCount=(@hitsCount-@CntM),HitsValue=(@hitsValue-@ValM) WHERE HitsID=@hitsID;
		END;
    END;
	    DELETE FROM [Analytics_HourHits] WHERE 
	      HitsStatisticsID=@HitsStatID AND HitsStartTime>=@From AND HitsEndTime<=@To;
	    DELETE FROM [Analytics_DayHits] WHERE 
	      HitsStatisticsID=@HitsStatID AND HitsStartTime>=@From AND HitsEndTime<=@To;
	    IF (@From <= @Week1End AND @Week2Start <= @To)
	    BEGIN
	    DELETE FROM [Analytics_WeekHits] WHERE 
	      HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Week1End AND HitsEndTime<=@Week2Start;
	    END;
	    IF (@From <= @Month1End AND @Month2Start <= @To)
	    BEGIN
	    DELETE FROM [Analytics_MonthHits] WHERE 
	      HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Month1End AND HitsEndTime<=@Month2Start;
	    END;    
	    IF (@From <= @Year1End AND @Year2Start <= @To)
	    BEGIN
	    DELETE FROM [Analytics_YearHits] WHERE 
	      HitsStatisticsID=@HitsStatID AND HitsStartTime>=@Year1End AND HitsEndTime<=@Year2Start;
	    END;    
		FETCH NEXT FROM mycursor INTO @HitsStatID
      END
	DEALLOCATE mycursor;
	-- Delete zero stats
	DELETE FROM [Analytics_HourHits] WHERE HitsCount <= 0
	DELETE FROM [Analytics_DayHits] WHERE HitsCount <= 0
	DELETE FROM [Analytics_MonthHits] WHERE HitsCount <= 0
	DELETE FROM [Analytics_WeekHits] WHERE HitsCount <= 0
	DELETE FROM [Analytics_YearHits] WHERE HitsCount <= 0
	DECLARE @stat TABLE (
	  StatisticsID int
	)
	-- Get stats ID with no stats
	INSERT INTO @stat SELECT StatisticsID FROM (
	(SELECT StatisticsID FROM [Analytics_Statistics] WHERE StatisticsID NOT IN (SELECT HitsStatisticsID FROM [Analytics_HourHits])) UNION
	(SELECT StatisticsID FROM [Analytics_Statistics] WHERE StatisticsID NOT IN (SELECT HitsStatisticsID FROM [Analytics_DayHits])) UNION
	(SELECT StatisticsID FROM [Analytics_Statistics] WHERE StatisticsID NOT IN (SELECT HitsStatisticsID FROM [Analytics_WeekHits])) UNION
	(SELECT StatisticsID FROM [Analytics_Statistics] WHERE StatisticsID NOT IN (SELECT HitsStatisticsID FROM [Analytics_MonthHits])) UNION
	(SELECT StatisticsID FROM [Analytics_Statistics] WHERE StatisticsID NOT IN (SELECT HitsStatisticsID FROM [Analytics_YearHits]))
	) as tab
	-- Remove dependencies
	DELETE FROM [Analytics_HourHits] WHERE HitsStatisticsID IN (SELECT StatisticsID FROM @stat)
	DELETE FROM [Analytics_DayHits] WHERE HitsStatisticsID IN (SELECT StatisticsID FROM @stat)
	DELETE FROM [Analytics_WeekHits] WHERE HitsStatisticsID IN (SELECT StatisticsID FROM @stat)
	DELETE FROM [Analytics_MonthHits] WHERE HitsStatisticsID IN (SELECT StatisticsID FROM @stat)
	DELETE FROM [Analytics_YearHits] WHERE HitsStatisticsID IN (SELECT StatisticsID FROM @stat)
	-- Remove master record
	DELETE FROM [Analytics_Statistics] WHERE StatisticsID IN (SELECT StatisticsID FROM @stat)', 0, 1366, 0, '20120207 11:19:38', 'ac926217-6c7e-4a18-ab63-b4fd67bd2b69', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13740, N'removeAllSiteAnalyticsData', 0, N'DELETE FROM Analytics_HourHits  WHERE HitsStatisticsID IN (
SELECT StatisticsID FROM Analytics_Statistics WHERE (##WHERE##) AND (StatisticsSiteID = @SiteID OR @SiteID = 0))    
DELETE FROM Analytics_DayHits  WHERE HitsStatisticsID IN (
SELECT StatisticsID FROM Analytics_Statistics WHERE (##WHERE##) AND (StatisticsSiteID = @SiteID OR @SiteID = 0))    
DELETE FROM Analytics_WeekHits  WHERE  HitsStatisticsID IN (
SELECT StatisticsID FROM Analytics_Statistics WHERE (##WHERE##) AND (StatisticsSiteID = @SiteID OR @SiteID = 0))    
DELETE FROM Analytics_MonthHits  WHERE HitsStatisticsID IN (
SELECT StatisticsID FROM Analytics_Statistics WHERE (##WHERE##) AND (StatisticsSiteID = @SiteID OR @SiteID = 0))    
DELETE FROM Analytics_YearHits  WHERE HitsStatisticsID IN (
SELECT StatisticsID FROM Analytics_Statistics WHERE (##WHERE##) AND (StatisticsSiteID = @SiteID OR @SiteID = 0))    
DELETE FROM Analytics_Statistics WHERE 
    StatisticsID NOT IN (SELECT HitsStatisticsID FROM Analytics_YearHits)   
AND StatisticsID NOT IN (SELECT HitsStatisticsID FROM Analytics_MonthHits)  
AND StatisticsID NOT IN (SELECT HitsStatisticsID FROM Analytics_WeekHits)   
AND StatisticsID NOT IN (SELECT HitsStatisticsID FROM Analytics_DayHits)  
AND StatisticsID NOT IN (SELECT HitsStatisticsID FROM Analytics_HourHits)', 0, 1366, 0, '20120207 11:20:16', '4e7cf950-c5cd-44e0-89fd-df65cb3f1754', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (8480, N'smartsearchattachments', 0, N'SELECT ##TOPN## SUM(RANK) AS [Score], DocumentID, SiteName, NodeID, NodeAliasPath, DocumentCulture, NodeClassID, ClassName, NodeACLID, NodeSiteID, NodeLinkedNodeID, NodeOwner
FROM CMS_Attachment INNER JOIN
CONTAINSTABLE(CMS_Attachment, AttachmentBinary, ##SEARCH## ) AS KEY_TBL ON CMS_Attachment.AttachmentID = KEY_TBL.[KEY] INNER JOIN
View_CMS_Tree_Joined ON View_CMS_Tree_Joined.DocumentID = CMS_Attachment.AttachmentDocumentID
WHERE (Published = 1) AND (##WHERE##) 
GROUP BY DocumentID, SiteName, NodeID, NodeAliasPath, DocumentCulture, NodeClassID, ClassName, NodeACLID, NodeSiteID, NodeLinkedNodeID, NodeOwner ORDER BY ##ORDERBY##', 0, 1095, 1, '20120216 08:50:56', '80834b50-0ab4-445e-99a4-775df7a1a2e3', 0, 1)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (13879, N'updateall', 0, N'UPDATE CMS_WebFarmTask SET ##COLUMNS## WHERE ##WHERE##', 0, 1093, 0, '20120308 10:47:07', '7a94ffda-5fec-484a-9d3f-b722bdd128bb', 0, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7928, N'disableolderversions', 0, N'UPDATE CMS_VersionHistory SET ToBePublished = 0 WHERE DocumentID = @DocumentID AND VersionHistoryID <= @VersionHistoryID', 0, 214, 0, '20090109 16:22:26', '280f575a-cd63-4692-953b-c2ba64f16418', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7882, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Blog_PostSubscription WHERE (SubscriptionLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 2018, 0, '20081229 09:06:57', '348b2949-16c5-42d7-87e4-294b7a0bee10', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (9461, N'selectalljoinuser', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Reporting_SavedReport 
LEFT JOIN CMS_User ON SavedReportCreatedByUserID = UserID 
WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 1350, 0, '20091125 16:37:14', '3fc23503-808c-4b48-9864-4d936367dd6d', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7924, N'SelectForResManExportImport', 0, N'SELECT StringLoadGeneration, StringKey, DefaultText, CultureText, StringIsCustom FROM (SELECT resourceStrings1.StringLoadGeneration, resourceStrings1.StringKey, CAST(defaultLanguage.TranslationText AS nvarchar(4000)) AS DefaultText, CAST(cultureLanguage.TranslationText AS nvarchar(4000)) AS CultureText, resourceStrings1.StringIsCustom FROM CMS_ResourceTranslation AS defaultLanguage INNER JOIN CMS_ResourceString AS resourceStrings1 ON resourceStrings1.StringID = defaultLanguage.TranslationStringID LEFT OUTER JOIN CMS_ResourceTranslation AS cultureLanguage ON defaultLanguage.TranslationStringID = cultureLanguage.TranslationStringID AND (cultureLanguage.TranslationUICultureID IS NULL OR cultureLanguage.TranslationUICultureID = @Culture) WHERE (defaultLanguage.TranslationUICultureID = @DefaultUICultureID) UNION SELECT resourceStrings2.StringLoadGeneration, resourceStrings2.StringKey, CAST(defaultLanguage.TranslationText AS nvarchar(4000)) AS DefaultText, CAST(cultureLanguage.TranslationText AS nvarchar(4000)) AS CultureText, resourceStrings2.StringIsCustom FROM CMS_ResourceTranslation AS cultureLanguage INNER JOIN CMS_ResourceString AS resourceStrings2 ON resourceStrings2.StringID = cultureLanguage.TranslationStringID LEFT OUTER JOIN CMS_ResourceTranslation AS defaultLanguage ON defaultLanguage.TranslationStringID = cultureLanguage.TranslationStringID AND defaultLanguage.TranslationUICultureID IS NULL WHERE (cultureLanguage.TranslationUICultureID = @Culture) AND (NOT EXISTS (SELECT TranslationID, TranslationStringID, TranslationUICultureID, CAST(TranslationText AS nvarchar(4000)) AS Expr1 FROM CMS_ResourceTranslation WHERE (TranslationUICultureID = @DefaultUICultureID) AND (TranslationStringID = cultureLanguage.TranslationStringID))) UNION SELECT StringLoadGeneration, StringKey, NULL AS DefaultText, NULL AS CultureText, StringIsCustom FROM CMS_ResourceString WHERE (StringID NOT IN (SELECT TranslationStringID FROM CMS_ResourceTranslation AS CMS_ResourceTranslation_1 WHERE (TranslationUICultureID = @Culture) OR (TranslationUICultureID = @DefaultUICultureID)))) AS StringInfoRows', 0, 1650, 0, '20090106 12:41:51', '85990c7d-7542-4915-bdbf-a35e17d74caf', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7877, N'select', 0, N'SELECT ##COLUMNS## FROM Blog_PostSubscription WHERE [SubscriptionID] = @ID', 0, 2018, 0, '20081229 09:06:57', '0788774d-ca28-4a5f-9028-11b9f6d24bd6', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7744, N'selectspecobjhits', 0, N'SELECT SUM(HitsCount) FROM Analytics_Statistics, ##HITSTABLE## WHERE ##WHERE## AND StatisticsSiteID=@SiteID AND StatisticsCode=@CodeName AND StatisticsID=HitsStatisticsID AND StatisticsObjectID=@ObjectID AND HitsStartTime >= @TimeBegin AND HitsEndTime <= @TimeEnd', 0, 1366, 0, '20090528 09:34:57', '9cebb6be-d0a2-4496-9c5a-c71d41c2d206', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7739, N'select', 0, N'SELECT ##COLUMNS## FROM Community_GroupRolePermission WHERE [GroupID] = @GroupID AND [RoleID] = @RoleID AND [PermissionID] = @PermissionID', 0, 1995, 0, '20081229 09:07:08', '32b0061e-edc4-4a99-bbc8-fb4044a617e0', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7734, N'selectformyinvitations', 0, N'SELECT ##COLUMNS## FROM Community_Invitation 
JOIN CMS_User 
ON Community_Invitation.InvitedByUserID = CMS_User.UserID 
JOIN Community_Group 
ON Community_Invitation.InvitationGroupID = Community_Group.GroupID
WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 1962, 0, '20081208 19:03:25', '11c13e03-ab4b-4486-b175-ce5d67a77b61', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7735, N'selectformysentinvitations', 0, N'SELECT ##COLUMNS## FROM Community_Invitation 
FULL JOIN CMS_User 
ON Community_Invitation.InvitedUserID = CMS_User.UserID 
JOIN Community_Group 
ON Community_Invitation.InvitationGroupID = Community_Group.GroupID
WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 1962, 0, '20081215 19:09:39', '641f53f0-cf4a-4490-84e2-14149249f026', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7346, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM COM_CurrencyExchangeRate WHERE (ExchangeRateLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1202, 0, '20081229 09:07:00', '0ba7464a-a21a-415f-8f6d-9ecd77c05ab0', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7276, N'select', 0, N'SELECT ##COLUMNS## FROM Community_Invitation WHERE [InvitationID] = @ID', 0, 1962, 0, '20081229 09:07:09', 'a44ee20b-56fc-405c-8627-c145335ed19d', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7132, N'select', 0, N'SELECT ##COLUMNS## FROM Media_LibraryRolePermission WHERE [LibraryID] = @LibraryID AND [RoleID] = @RoleID AND [PermissionID] = @PermissionID', 0, 1937, 0, '20081229 09:07:11', '5d65571e-ee05-4b0a-8821-6774b6454160', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6996, N'select', 0, N'SELECT ##COLUMNS## FROM Forums_UserFavorites WHERE [FavoriteID] = @ID', 0, 1913, 0, '20081229 09:07:08', '37d1c04b-15ad-436f-a567-49e213c50f81', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6969, N'selectwithsite', 0, N'SELECT ##TOPN## Board_Board.*,CMS_Tree.NodeSiteID
FROM Board_Board JOIN CMS_Document ON Board_Board.BoardDocumentID = CMS_Document.DocumentID 
	JOIN CMS_Tree ON CMS_Document.DocumentNodeID = CMS_Tree.NodeID
WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 1788, 0, '20080930 14:01:43', 'ada940c3-ee2d-420a-9f0f-f1757bd7e21c', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6900, N'select', 0, N'SELECT ##COLUMNS## FROM Board_Subscription WHERE [SubscriptionID] = @ID', 0, 1895, 0, '20081229 09:07:12', 'b1e1d84e-73b4-4c31-b74e-6921c4b43971', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6859, N'select', 0, N'SELECT ##COLUMNS## FROM Messaging_IgnoreList WHERE [IgnoreListUserID] = @IgnoreListUserID AND [IgnoreListIgnoredUserID] = @IgnoreListIgnoredUserID', 0, 1888, 0, '20081229 09:07:12', 'eb1de797-c592-4b6e-aefd-d106e8b8723f', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6854, N'select', 0, N'SELECT ##COLUMNS## FROM Messaging_ContactList WHERE [ContactListUserID] = @ContactListUserID AND [ContactListContactUserID] = @ContactListContactUserID', 0, 1887, 0, '20081229 09:07:12', 'bc2c8c7b-2d64-4354-989a-ec766dd68c1e', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6614, N'select', 0, N'SELECT ##COLUMNS## FROM Notification_Subscription WHERE [SubscriptionID] = @ID', 0, 1815, 0, '20081229 09:07:13', 'cd943779-31ff-4ea9-9679-d129d77661bf', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6609, N'select', 0, N'SELECT ##COLUMNS## FROM Notification_TemplateText WHERE [TemplateTextID] = @ID', 0, 1814, 0, '20081229 09:07:13', 'c6703b4b-11e8-49a7-b665-a4dc3ec23d9b', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6604, N'select', 0, N'SELECT ##COLUMNS## FROM Notification_Template WHERE [TemplateID] = @ID', 0, 1813, 0, '20081229 09:07:13', 'c2efcfc9-5da3-4e69-836e-4f3556f45169', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6551, N'select', 0, N'SELECT ##COLUMNS## FROM Board_Moderator WHERE [BoardID] = @BoardID AND [UserID] = @UserID', 0, 1804, 0, '20081229 09:07:11', 'dcebca6f-bc2a-49ab-9b4a-25a850969b07', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6546, N'select', 0, N'SELECT ##COLUMNS## FROM BadWords_WordCulture WHERE [WordID] = @WordID AND [CultureID] = @CultureID', 0, 1803, 0, '20081229 09:06:54', '17a5636b-c970-4648-8c99-58dfda981d49', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6518, N'select', 0, N'SELECT ##COLUMNS## FROM Board_Role WHERE [BoardID] = @BoardID AND [RoleID] = @RoleID', 0, 1797, 0, '20081229 09:07:12', '0f343625-c9a2-463b-8104-4d1508004ad7', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6486, N'select', 0, N'SELECT ##COLUMNS## FROM Board_Message WHERE [MessageID] = @ID', 0, 1791, 0, '20081229 09:07:11', '4bd0d05e-68bd-446f-9d3d-fd181391ec01', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6565, N'selectbycultureid', 0, N'SELECT ##TOPN## ##COLUMNS## FROM BadWords_Word WHERE WordID IN (SELECT WordID FROM BadWords_WordCulture WHERE CultureID = @CultureID)', 0, 1771, 0, '20091012 08:50:02', '55b0495f-7776-4d03-a602-9b638c09592f', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6571, N'select', 0, N'SELECT ##COLUMNS## FROM Notification_Gateway WHERE [GatewayID] = @ID', 0, 1808, 0, '20081229 09:07:13', '5614b552-9c59-48fe-9264-211b3cb61468', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6258, N'select', 0, N'SELECT ##COLUMNS## FROM Community_GroupMember WHERE [MemberID] = @ID', 0, 1749, 0, '20081229 09:07:08', 'ee481843-5123-49ce-8110-13a208e6261f', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (6033, N'select', 0, N'SELECT ##COLUMNS## FROM COM_DepartmentTaxClass WHERE [DepartmentID] = @DepartmentID AND [TaxClassID] = @TaxClassID', 0, 1720, 0, '20081229 09:07:00', 'bbba5a88-217c-4bb2-a5ae-f6f80e826125', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5571, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Export_Task WHERE (TaskTime >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1617, 0, '20091012 07:43:05', '410cac5a-1cdd-4f1d-ba9a-ffac0b3537aa', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5727, N'selectspecobj', 0, N'SELECT * FROM Analytics_Statistics, ##HITSTABLE## WHERE ##WHERE## AND StatisticsSiteID=@SiteID AND StatisticsCode=@CodeName AND StatisticsID=HitsStatisticsID AND StatisticsObjectID=@ObjectID AND HitsStartTime >= @TimeBegin AND HitsEndTime <= @TimeEnd', 0, 1366, 0, '20090528 09:34:50', '7895d24e-f556-4966-942c-926f4090909c', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5424, N'selectIgnoreList', 0, N'SELECT ##TOPN## ##COLUMNS## FROM View_Messaging_IgnoreList WHERE IgnoreListUserID=@UserID AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1888, 0, '20090819 18:51:19', 'f41cb287-9535-4707-a557-0e2806a9f68a', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5428, N'selectContactList', 0, N'SELECT ##TOPN## ##COLUMNS## FROM View_Messaging_ContactList WHERE ContactListUserID=@UserID AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1887, 0, '20090819 18:51:00', 'f41cb287-9535-4707-a557-0e2806a9f68b', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5431, N'SelectCount', 0, N'SELECT COUNT(CommentID) FROM Blog_Comment WHERE CommentPostDocumentID = @CommentPostDocumentID AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1360, 0, '20080425 00:00:00', 'ff247c39-574a-4807-bbdb-e42b512f989d', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5274, N'select', 0, N'SELECT ##COLUMNS## FROM Forums_ForumModerators WHERE [UserID] = @UserID AND [ForumID] = @ForumID', 0, 1659, 0, '20081229 09:07:08', '9de29dfe-4ead-451b-be7c-01d47ecf7a85', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5200, N'select', 0, N'SELECT ##COLUMNS## FROM Polls_PollSite WHERE [PollID] = @PollID AND [SiteID] = @SiteID', 0, 1646, 0, '20081229 09:07:16', '4fa90d49-8f13-4b1d-a730-5cf640c67543', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5195, N'select', 0, N'SELECT ##COLUMNS## FROM Polls_PollRoles WHERE [PollID] = @PollID AND [RoleID] = @RoleID', 0, 1645, 0, '20081229 09:07:16', '1636b6b9-0c32-4614-9c21-3d7e8c6f4292', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5190, N'select', 0, N'SELECT ##COLUMNS## FROM Forums_ForumRoles WHERE [ForumID] = @ForumID AND [RoleID] = @RoleID AND [PermissionID] = @PermissionID', 0, 1644, 0, '20081229 09:07:08', '78c74e0f-a9e6-4c19-85ac-4f388ca9a2ab', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5185, N'select', 0, N'SELECT ##COLUMNS## FROM COM_UserDepartment WHERE [UserID] = @UserID AND [DepartmentID] = @DepartmentID', 0, 1643, 0, '20081229 09:07:40', '1b6645cd-4cb6-476d-a674-89e1a3cdd3ed', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5179, N'select', 0, N'SELECT ##COLUMNS## FROM COM_SKUTaxClasses WHERE [SKUID] = @SKUID AND [TaxClassID] = @TaxClassID', 0, 1642, 0, '20081229 09:07:24', '46326bad-8120-4917-aac3-4c6cf8ac1082', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5174, N'select', 0, N'SELECT ##COLUMNS## FROM COM_SKUOptionCategory WHERE [SKUID] = @SKUID AND [CategoryID] = @CategoryID', 0, 1641, 0, '20081229 09:07:23', '126f143b-0fca-437a-926c-4e54db611bf4', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5169, N'select', 0, N'SELECT ##COLUMNS## FROM COM_SKUDiscountCoupon WHERE [SKUID] = @SKUID AND [DiscountCouponID] = @DiscountCouponID', 0, 1640, 0, '20081229 09:07:23', '4793e957-3425-4b6c-8a03-526b297e0b2c', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5144, N'select', 0, N'SELECT ##COLUMNS## FROM COM_DiscountLevelDepartment WHERE [DiscountLevelID] = @DiscountLevelID AND [DepartmentID] = @DepartmentID', 0, 1636, 0, '20081229 09:06:59', '325c08c1-4ada-4d46-ac48-9fee314214af', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4909, N'select', 0, N'SELECT ##COLUMNS## FROM Export_Task WHERE [TaskID] = @ID', 0, 1617, 0, '20081229 09:07:06', '936f5043-f143-4c6c-94ac-30c9cf0aa8b0', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4970, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Polls_PollAnswer WHERE (AnswerLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1331, 0, '20081229 09:07:16', 'f9c9784d-ddde-4909-a085-fffeee33ed81', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4972, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Newsletter_EmailTemplate WHERE (TemplateLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 905, 0, '20081229 09:07:13', '061cba09-438b-4e42-8a00-9da95dae0d43', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4978, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Reporting_Report WHERE (ReportLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1338, 0, '20100325 18:30:53', '62c1ce27-1e93-46f9-acbe-373cfdf83d97', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4982, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Reporting_ReportTable WHERE (TableLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1341, 0, '20081229 09:07:22', 'a005d5df-dd99-43eb-9b65-aef0bcd4ea8d', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4983, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Reporting_ReportValue WHERE (ValueLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1342, 0, '20081229 09:07:22', '5afdb53f-9cb3-4e73-b7c7-42acc62b4760', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4904, N'select', 0, N'SELECT ##COLUMNS## FROM Export_History WHERE [ExportID] = @ID', 0, 1616, 0, '20081229 09:07:06', 'c5058935-88ec-415b-adce-8d4691f31fb1', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4683, N'selectcount', 0, N'SELECT COUNT(MessageID) FROM Messaging_Message WHERE ##WHERE##', 0, 1593, 0, '20090103 17:27:19', 'c0a87b7e-6431-404d-a0d8-9c3be0c8b8a5', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (4015, N'selectstatetaxclasses', 0, N'SELECT COM_SKUTaxClasses.SKUID, COM_TaxClass.TaxClassID, COM_TaxClass.TaxClassDisplayName, COM_TaxClass.TaxClassZeroIfIDSupplied, COM_TaxClassState.StateID, COM_TaxClassState.TaxValue, COM_TaxClassState.IsFlatValue FROM (COM_SKUTaxClasses INNER JOIN COM_TaxClass ON COM_SKUTaxClasses.TaxClassID = COM_TaxClass.TaxClassID)  INNER JOIN COM_TaxClassState ON COM_TaxClass.TaxClassID = COM_TaxClassState.TaxClassID WHERE COM_TaxClassState.StateID IN (SELECT StateID FROM CMS_State WHERE CountryID = @CountryID) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1162, 0, '20080313 09:35:00', 'ec9de272-2e1e-4312-80c2-9a124424914e', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (3757, N'SelectForSubExport', 0, N'SELECT DISTINCT SubscriberEmail, SubscriberFirstName,SubscriberLastName FROM Newsletter_Subscriber WHERE (SubscriberID IN (SELECT SubscriberID FROM Newsletter_SubscriberNewsletter WHERE ##WHERE##) AND NOT SubscriberEmail IS NULL) ORDER BY SubscriberEmail', 0, 908, 0, '20080313 09:35:00', '91b91898-1e53-43e5-958f-1701d32ffccb', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (3794, N'select', 0, N'SELECT ##COLUMNS## FROM COM_VolumeDiscount WHERE [VolumeDiscountID] = @ID', 0, 1424, 0, '20081229 09:07:03', '0f21a1e4-f112-47cd-b0e1-94b7baa12478', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (3474, N'select', 0, N'SELECT ##COLUMNS## FROM Reporting_SavedReport WHERE [SavedReportID] = @ID', 0, 1350, 0, '20081229 09:07:21', '80ca4262-f28f-4239-8e24-62cc39323d40', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (3801, N'selectwishlistforuser', 0, N'SELECT COM_SKU.* FROM COM_SKU, COM_Wishlist WHERE COM_Wishlist.UserID = @UserID AND COM_Wishlist.SKUID = COM_SKU.SKUID  AND (COM_Wishlist.SiteID = @SiteID OR COM_Wishlist.SiteID IS NULL)', 0, 1159, 0, '20080313 09:35:00', 'cbc4907c-55ee-4c4f-b9aa-39f1f8ab0109', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (3548, N'select', 0, N'SELECT ##COLUMNS## FROM Blog_Comment WHERE [CommentID] = @ID', 0, 1360, 0, '20090107 14:29:28', 'b12c6533-ca91-42ad-937b-9955c35a6b63', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (3415, N'select', 0, N'SELECT ##COLUMNS## FROM Reporting_ReportValue WHERE [ValueID] = @ID', 0, 1342, 0, '20081229 09:07:22', 'c9b7b53a-5007-4981-8850-3fdbb9169aa2', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (3410, N'select', 0, N'SELECT ##COLUMNS## FROM Reporting_ReportTable WHERE [TableID] = @ID', 0, 1341, 0, '20081229 09:07:22', 'ef49b3d8-4d6f-4021-bc63-60cc07e1f9e5', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (3395, N'select', 0, N'SELECT ##COLUMNS## FROM Reporting_Report WHERE [ReportID] = @ID', 0, 1338, 0, '20100325 18:30:53', '938ee14d-dd47-4873-8799-249482291038', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (3144, N'select', 0, N'SELECT ##COLUMNS## FROM COM_CurrencyExchangeRate WHERE [ExchagneRateID] = @ID', 0, 1202, 0, '20081229 09:07:00', 'fe05da59-0db4-4e42-be41-28a04765fa0a', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2836, N'selectitemsbyuserid', 0, N'SELECT COM_ShoppingCartSKU.ShoppingCartID, COM_ShoppingCartSKU.SKUUnits, COM_SKU.* FROM COM_ShoppingCart INNER JOIN COM_ShoppingCartSKU ON COM_ShoppingCart.ShoppingCartID = COM_ShoppingCartSKU.ShoppingCartID INNER JOIN COM_SKU ON COM_ShoppingCartSKU.SKUID = COM_SKU.SKUID WHERE COM_ShoppingCart.ShoppingCartUserID = @ShoppingCartUserID ORDER BY COM_ShoppingCart.ShoppingCartLastUpdate DESC', 0, 1162, 0, '20080313 09:35:00', 'f6a27d96-a66a-49a5-a40d-992bec4276d1', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2837, N'selectitemsbyguid', 0, N'SELECT COM_ShoppingCartSKU.ShoppingCartID, COM_ShoppingCartSKU.SKUUnits, COM_SKU.* FROM COM_ShoppingCart INNER JOIN COM_ShoppingCartSKU ON COM_ShoppingCart.ShoppingCartID = COM_ShoppingCartSKU.ShoppingCartID INNER JOIN COM_SKU ON COM_ShoppingCartSKU.SKUID = COM_SKU.SKUID WHERE COM_ShoppingCart.ShoppingCartGUID = @ShoppingCartGUID', 0, 1162, 0, '20080313 09:35:00', '7b02f4cb-f6f7-4700-b969-07c5bb245e72', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2838, N'selectitems', 0, N'SELECT COM_SKU.*, COM_ShoppingCartSKU.* FROM COM_ShoppingCartSKU INNER JOIN COM_SKU ON COM_ShoppingCartSKU.SKUID = COM_SKU.SKUID WHERE COM_ShoppingCartSKU.ShoppingCartID = @ShoppingCartID', 0, 1162, 0, '20080313 09:35:00', 'e27b9f6f-cb29-4504-9649-bbf4abe3ab29', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2574, N'selecttasklist', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Staging_Task WHERE (TaskSiteID IS NULL OR TaskSiteID = @TaskSiteID) AND (TaskID IN (SELECT SynchronizationTaskID FROM Staging_Synchronization WHERE SynchronizationServerID = @ServerID OR (@ServerID = 0 AND (@TaskSiteID = 0 OR SynchronizationServerID IN (SELECT ServerID FROM Staging_Server WHERE ServerSiteID = @TaskSiteID AND ServerEnabled=1))))) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1134, 0, '20100308 18:23:44', '306eed67-38a4-450b-8e87-db7258e20679', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2592, N'selecttasksynchronization', 0, N'SELECT * FROM Staging_Synchronization WHERE SynchronizationTaskID = @TaskID AND (SynchronizationServerID = @ServerID OR (@ServerID = 0 AND (@SiteID = 0 OR SynchronizationServerID IN (SELECT ServerID FROM Staging_Server WHERE ServerSiteID = @SiteID AND ServerEnabled=1)))) AND ##WHERE## ORDER BY ##ORDERBY##', 0, 1131, 0, '20091125 16:12:34', 'f34fe7e5-b2ba-43e4-9ada-32f83d355c4e', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2552, N'select', 0, N'SELECT ##COLUMNS## FROM Staging_Synchronization WHERE [SynchronizationID] = @ID', 0, 1131, 0, '20081229 09:07:24', 'fefd1264-46f5-4368-a5f6-5a4ec75176a8', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2497, N'SelectPosts', 0, N'SELECT ##TOPN## ##COLUMNS##, [CMS_User].UserName, [CMS_UserSettings].UserForumPosts, [CMS_UserSettings].UserActivityPoints,[CMS_UserSettings].UserGender, [CMS_UserSettings].UserPicture, [CMS_Badge].BadgeDisplayName, [CMS_Badge].BadgeImageURL, [CMS_Avatar].AvatarGUID
FROM [Forums_ForumPost] 
LEFT JOIN CMS_User ON [CMS_User].UserID = [Forums_ForumPost].PostUserID
LEFT JOIN CMS_UserSettings ON [CMS_UserSettings].UserSettingsUserID = [Forums_ForumPost].PostUserID
LEFT JOIN CMS_Badge ON [CMS_Badge].BadgeID = [CMS_UserSettings].UserBadgeID
LEFT JOIN CMS_Avatar ON [CMS_Avatar].AvatarID = [CMS_UserSettings].UserAvatarID
WHERE (##WHERE##) ORDER BY ##ORDERBY##', 0, 1123, 0, '20090525 09:37:46', '527626bb-86a4-4936-a3d0-5a77e970d7b4', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2486, N'selectByGroupName', 0, N'SELECT * FROM [Forums_ForumGroup] WHERE [GroupName] = @GroupName AND [GroupSiteID] = @ID AND [GroupGroupID] = @GroupGroupID', 0, 1121, 0, '20100205 13:31:55', 'ba22bb9d-f03a-4b1e-bd14-8f52c06efcb2', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (1441, N'selectqueue', 0, N'SELECT ##TOPN## ##COLUMNS## FROM CMS_Site INNER JOIN Newsletter_Newsletter ON SiteID = NewsletterSiteID INNER JOIN Newsletter_NewsletterIssue ON NewsletterID = IssueNewsletterID INNER JOIN Newsletter_Emails ON IssueID = EmailNewsletterIssueID INNER JOIN Newsletter_Subscriber ON Newsletter_Emails.EmailSubscriberID = Newsletter_Subscriber.SubscriberID WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 919, 0, '20100308 19:38:10', '6759b6ee-6b7e-423c-8a4a-5a69fb3e9795', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (1367, N'select', 0, N'SELECT ##COLUMNS## FROM Newsletter_Emails WHERE [EmailID] = @ID', 0, 919, 0, '20081229 09:07:13', '747b86ec-b830-4394-8dab-3a7e61b76df4', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (1299, N'selectByTemplateName', 0, N'SELECT * FROM Newsletter_EmailTemplate WHERE TemplateName = @TemplateName AND TemplateSiteID = @TemplateSiteID', 0, 905, 0, '20080313 09:35:00', '7024e7ce-5ff2-4e00-b063-e8b6dc7032ff', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (2946, N'selectItemsByOrderID', 0, N'SELECT COM_SKU.*, COM_OrderItem.* FROM COM_Order JOIN COM_OrderItem ON COM_Order.OrderID = COM_OrderItem.OrderItemOrderID JOIN COM_SKU ON COM_SKU.SKUID = COM_OrderItem.OrderItemSKUID WHERE COM_Order.OrderID = @OrderID', 0, 1162, 0, '20080313 09:35:00', '77fef092-60dc-4747-9b3e-c4fa9bcc3231', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (1294, N'select', 0, N'SELECT ##COLUMNS## FROM Newsletter_EmailTemplate WHERE [TemplateID] = @ID', 0, 905, 0, '20081229 09:07:12', '09e434cb-1f1c-474f-9b43-00fa2cb4f9f5', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7895, N'selectforuser', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Blog_PostSubscription, View_CMS_Tree_Joined WHERE SubscriptionUserID=@UserID AND SubscriptionPostDocumentID=DocumentID AND NodeSiteID=@SiteID AND ##WHERE##', 0, 2018, 0, '20100308 13:41:29', '3acbc458-c25a-4037-873b-6e80e33916d3', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7117, N'select', 0, N'SELECT ##COLUMNS## FROM Media_Library WHERE [LibraryID] = @ID', 0, 1934, 0, '20081229 09:07:11', '0e3976b1-3742-4686-a4f5-4b86e5c406a9', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5217, N'selectview', 0, N'SELECT ##TOPN## ##COLUMNS## FROM View_NewsletterSubscriberUserRole_Joined WHERE ##WHERE## ORDER BY ##ORDERBY##', 0, 908, 0, '20090916 16:11:16', '44fe88db-1ac6-4011-a9ac-38995c51d570', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (5218, N'SelectTopNProductsBySales', 0, N'SELECT ##TOPN## SUM(OrderItemUnitCount) as cnt, OrderItemSKUID, OrderItemSKUName FROM COM_OrderItem WHERE OrderItemSKUID in (SELECT SKUID FROM COM_SKU WHERE SKUEnabled = 1) and OrderItemOrderID in (SELECT OrderID FROM COM_Order WHERE OrderSiteID = @SiteID) and (OrderItemParentGuid IS NULL) and ( ##WHERE## ) GROUP BY OrderItemSKUID, OrderItemSKUName ORDER BY cnt DESC , OrderItemSKUName ASC', 0, 1159, 0, '20080313 09:35:00', '0ab5f12a-8055-4529-bad3-095e17ed3c0a', 1, NULL)
INSERT INTO [CMS_Query] ([QueryID], [QueryName], [QueryTypeID], [QueryText], [QueryRequiresTransaction], [ClassID], [QueryIsLocked], [QueryLastModified], [QueryGUID], [QueryLoadGeneration], [QueryIsCustom]) VALUES (7432, N'selectmodifiedfrom', 0, N'SELECT ##TOPN## ##COLUMNS## FROM Forums_UserFavorites WHERE (FavoriteLastModified >= @ModifiedFrom) AND (##WHERE##) ORDER BY ##ORDERBY##', 0, 1913, 0, '20081229 09:07:08', '067db2bc-ca90-43e0-b59c-cc64020c4f81', 1, NULL)
SET IDENTITY_INSERT [CMS_Query] OFF
